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

WP_Customize_Selective_Refresh::add_dynamic_partials() public WP 4.5.0

Registers dynamically-created partials.

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

Возвращает

WP_Customize_Partial[]. Array of added WP_Customize_Partial instances.

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

$WP_Customize_Selective_Refresh = new WP_Customize_Selective_Refresh();
$WP_Customize_Selective_Refresh->add_dynamic_partials( $partial_ids );
$partial_ids(строка[]) (обязательный)
Array of the partial IDs to add.

Заметки

  • Смотрите: WP_Customize_Manager::add_dynamic_settings()

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

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

Код WP_Customize_Selective_Refresh::add_dynamic_partials() WP 5.5.1

wp-includes/customize/class-wp-customize-selective-refresh.php
<?php
public function add_dynamic_partials( $partial_ids ) {
	$new_partials = array();

	foreach ( $partial_ids as $partial_id ) {

		// Skip partials already created.
		$partial = $this->get_partial( $partial_id );
		if ( $partial ) {
			continue;
		}

		$partial_args  = false;
		$partial_class = 'WP_Customize_Partial';

		/**
		 * Filters a dynamic partial's constructor arguments.
		 *
		 * For a dynamic partial to be registered, this filter must be employed
		 * to override the default false value with an array of args to pass to
		 * the WP_Customize_Partial constructor.
		 *
		 * @since 4.5.0
		 *
		 * @param false|array $partial_args The arguments to the WP_Customize_Partial constructor.
		 * @param string      $partial_id   ID for dynamic partial.
		 */
		$partial_args = apply_filters( 'customize_dynamic_partial_args', $partial_args, $partial_id );
		if ( false === $partial_args ) {
			continue;
		}

		/**
		 * Filters the class used to construct partials.
		 *
		 * Allow non-statically created partials to be constructed with custom WP_Customize_Partial subclass.
		 *
		 * @since 4.5.0
		 *
		 * @param string $partial_class WP_Customize_Partial or a subclass.
		 * @param string $partial_id    ID for dynamic partial.
		 * @param array  $partial_args  The arguments to the WP_Customize_Partial constructor.
		 */
		$partial_class = apply_filters( 'customize_dynamic_partial_class', $partial_class, $partial_id, $partial_args );

		$partial = new $partial_class( $this, $partial_id, $partial_args );

		$this->add_partial( $partial );
		$new_partials[] = $partial;
	}
	return $new_partials;
}