Automattic\WooCommerce\Admin
PageController::connect_page
Connect an existing page to wc-admin.
Method of the class: PageController{}
Hooks from the method
Returns
null. Nothing (null).
Usage
$PageController = new PageController(); $PageController->connect_page( $options );
- $options(array) (required)
Array describing the page.
-
id(string)
Id to reference the page. -
title(string|array)
Page title. Used in menus and breadcrumbs. -
parent(string|null)
Parent ID. Null for new top level page. -
path(string)
Path for this page. E.g. admin.php?page=wc-settings&tab=checkout -
capability(string)
Capability needed to access the page. -
icon(string)
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() PageController::connect page code WC 10.4.3
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;
}