WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WP_Widget::form_callback() public WP 2.8.0

Generates the widget control form (Do NOT override).

Это метод класса: WP_Widget{}

Хуки из метода
Возвращает

Строку/null.

Использование

$WP_Widget = new WP_Widget();
$WP_Widget->form_callback( $widget_args );
$widget_args(число/массив)

Internal order number of the widget instance, or array of multi-widget arguments.

  • number(число)
    Number increment used for multiples of the same widget.

По умолчанию: 1

Список изменений

С версии 2.8.0 Введена.

Код WP_Widget::form_callback() WP 5.5.1

wp-includes/class-wp-widget.php
<?php
public function form_callback( $widget_args = 1 ) {
	if ( is_numeric( $widget_args ) ) {
		$widget_args = array( 'number' => $widget_args );
	}

	$widget_args   = wp_parse_args( $widget_args, array( 'number' => -1 ) );
	$all_instances = $this->get_settings();

	if ( -1 == $widget_args['number'] ) {
		// We echo out a form where 'number' can be set later.
		$this->_set( '__i__' );
		$instance = array();
	} else {
		$this->_set( $widget_args['number'] );
		$instance = $all_instances[ $widget_args['number'] ];
	}

	/**
	 * Filters the widget instance's settings before displaying the control form.
	 *
	 * Returning false effectively short-circuits display of the control form.
	 *
	 * @since 2.8.0
	 *
	 * @param array     $instance The current widget instance's settings.
	 * @param WP_Widget $this     The current widget instance.
	 */
	$instance = apply_filters( 'widget_form_callback', $instance, $this );

	$return = null;
	if ( false !== $instance ) {
		$return = $this->form( $instance );

		/**
		 * Fires at the end of the widget control form.
		 *
		 * Use this hook to add extra fields to the widget form. The hook
		 * is only fired if the value passed to the 'widget_form_callback'
		 * hook is not false.
		 *
		 * Note: If the widget has no form, the text echoed from the default
		 * form method can be hidden using CSS.
		 *
		 * @since 2.8.0
		 *
		 * @param WP_Widget $this     The widget instance (passed by reference).
		 * @param null      $return   Return null if new fields are added.
		 * @param array     $instance An array of the widget's settings.
		 */
		do_action_ref_array( 'in_widget_form', array( &$this, &$return, $instance ) );
	}
	return $return;
}