Automattic\WooCommerce\Admin

PageController::connect_page()publicWC 1.0

Connect an existing page to wc-admin.

Метод класса: PageController{}

Хуки из метода

Возвращает

null. Ничего (null).

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

$PageController = new PageController();
$PageController->connect_page( $options );
$options(массив) (обязательный)

Array describing the page.

  • id(строка)
    Id to reference the page.

  • title(строка|массив)
    Page title. Used in menus and breadcrumbs.

  • parent(строка|null)
    Parent ID. Null for new top level page.

  • path(строка)
    Path for this page. E.g. admin.php?page=wc-settings&tab=checkout

  • capability(строка)
    Capability needed to access the page.

  • icon(строка)
    Icon. Dashicons helper class, base64-encoded SVG, or 'none'.

  • position(int)
    Menu item position.

  • js_page(true|false)
    If this is a JS-powered page.

Код PageController::connect_page() WC 8.7.0

public function connect_page( $options ) {
	if ( ! is_array( $options['title'] ) ) {
		$options['title'] = array( $options['title'] );
	}

	/**
	 * Filter the options when connecting or registering a page.
	 *
	 * Use the `js_page` option to determine if registering.
	 *
	 * @param array $options {
	 *   Array describing the page.
	 *
	 *   @type string       id           Id to reference the page.
	 *   @type string|array title        Page title. Used in menus and breadcrumbs.
	 *   @type string|null  parent       Parent ID. Null for new top level page.
	 *   @type string       screen_id    The screen ID that represents the connected page. (Not required for registering).
	 *   @type string       path         Path for this page. E.g. admin.php?page=wc-settings&tab=checkout
	 *   @type string       capability   Capability needed to access the page.
	 *   @type string       icon         Icon. Dashicons helper class, base64-encoded SVG, or 'none'.
	 *   @type int          position     Menu item position.
	 *   @type boolean      js_page      If this is a JS-powered page.
	 * }
	 */
	$options = apply_filters( 'woocommerce_navigation_connect_page_options', $options );

	// @todo check for null ID, or collision.
	$this->pages[ $options['id'] ] = $options;
}