[ Index ]

PHP Cross Reference of WordPress




/wp-includes/customize/ -> class-wp-customize-nav-menu-setting.php (summary)

Customize API: WP_Customize_Nav_Menu_Setting class

File Size: 651 lines (19 kb)
Included or required: 2 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

WP_Customize_Nav_Menu_Setting:: (11 methods):

Class: WP_Customize_Nav_Menu_Setting  - X-Ref

Customize Setting to represent a nav_menu.

Subclass of WP_Customize_Setting to represent a nav_menu taxonomy term, and
the IDs for the nav_menu_items associated with the nav menu.

__construct( WP_Customize_Manager $manager, $id, array $args = array()   X-Ref

Any supplied $args override class property defaults.

since: 4.3.0
param: WP_Customize_Manager $manager Customizer bootstrap instance.
param: string               $id      A specific ID of the setting.
param: array                $args    Optional. Setting arguments.

value()   X-Ref
Get the instance data for a given widget setting.

since: 4.3.0
return: array Instance data.

preview()   X-Ref
Handle previewing the setting.

since: 4.3.0
since: 4.4.0 Added boolean return value
return: bool False if method short-circuited due to no-op.

filter_wp_get_nav_menus( $menus, $args )   X-Ref
Filters the wp_get_nav_menus() result to ensure the inserted menu object is included, and the deleted one is removed.

since: 4.3.0
param: WP_Term[] $menus An array of menu objects.
param: array     $args  An array of arguments used to retrieve menu objects.
return: WP_Term[] Array of menu objects.

_sort_menus_by_orderby( $menu1, $menu2 )   X-Ref
Sort menu objects by the class-supplied orderby property.

This is a workaround for a lack of closures.

since: 4.3.0
param: object $menu1
param: object $menu2
return: int

filter_wp_get_nav_menu_object( $menu_obj, $menu_id )   X-Ref
Filters the wp_get_nav_menu_object() result to supply the previewed menu object.

Requesting a nav_menu object by anything but ID is not supported.

since: 4.3.0
param: object|null $menu_obj Object returned by wp_get_nav_menu_object().
param: string      $menu_id  ID of the nav_menu term. Requests by slug or name will be ignored.
return: object|null

filter_nav_menu_options( $nav_menu_options )   X-Ref
Filters the nav_menu_options option to include this menu's auto_add preference.

since: 4.3.0
param: array $nav_menu_options Nav menu options including auto_add.
return: array (Maybe) modified nav menu options.

sanitize( $value )   X-Ref
Sanitize an input.

Note that parent::sanitize() erroneously does wp_unslash() on $value, but
we remove that in this override.

since: 4.3.0
param: array $value The menu value to sanitize.
return: array|false|null Null if an input isn't valid. False if it is marked for deletion.

update( $value )   X-Ref
Create/update the nav_menu term for this setting.

Any created menus will have their assigned term IDs exported to the client
via the {@see 'customize_save_response'} filter. Likewise, any errors will be exported
to the client via the customize_save_response() filter.

To delete a menu, the client can send false as the value.

since: 4.3.0
param: array|false $value {
return: null|void

filter_nav_menu_options_value( $nav_menu_options, $menu_id, $auto_add )   X-Ref
Updates a nav_menu_options array.

since: 4.3.0
param: array $nav_menu_options Array as returned by get_option( 'nav_menu_options' ).
param: int   $menu_id          The term ID for the given menu.
param: bool  $auto_add         Whether to auto-add or not.
return: array (Maybe) modified nav_menu_options array.

amend_customize_save_response( $data )   X-Ref
Export data for the JS client.

since: 4.3.0
param: array $data Additional information passed back to the 'saved' event on `wp.customize`.
return: array Export data.

Generated: Sun May 29 01:00:02 2022 Cross-referenced by PHPXref 0.7.1