WordPress.org

Make WordPress Core

Ticket #47678: 47678-_register_widget_form_callback.patch

File 47678-_register_widget_form_callback.patch, 1.3 KB (added by jrf, 9 months ago)

Simplify & modernize _register_widget_form_callback()

  • src/wp-includes/widgets.php

    From ff0b6775e3acd180d3d9c27fdc68238768588203 Mon Sep 17 00:00:00 2001
    From: jrfnl <jrfnl@users.noreply.github.com>
    Date: Thu, 11 Jul 2019 12:29:52 +0200
    Subject: [PATCH] Simplify & modernize _register_widget_form_callback()
    
    ---
     src/wp-includes/widgets.php | 4 ++--
     1 file changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/src/wp-includes/widgets.php b/src/wp-includes/widgets.php
    index 5a3937fbf5..bb52ef3a1b 100644
    a b function _register_widget_update_callback( $id_base, $update_callback, $options 
    577577 * @param mixed      ...$params     Optional additional parameters to pass to the callback function when it's called.
    578578 */
    579579
    580 function _register_widget_form_callback( $id, $name, $form_callback, $options = array() ) {
     580function _register_widget_form_callback( $id, $name, $form_callback, $options = array(), ...$params ) {
    581581        global $wp_registered_widget_controls;
    582582
    583583        $id = strtolower( $id );
    function _register_widget_form_callback( $id, $name, $form_callback, $options = 
    603603                'name'     => $name,
    604604                'id'       => $id,
    605605                'callback' => $form_callback,
    606                 'params'   => array_slice( func_get_args(), 4 ),
     606                'params'   => $params,
    607607        );
    608608        $widget = array_merge( $widget, $options );
    609609