[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

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

Customize API: WP_Customize_Nav_Menu_Setting class

File Size: 649 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):
  __construct()
  value()
  preview()
  filter_wp_get_nav_menus()
  _sort_menus_by_orderby()
  filter_wp_get_nav_menu_object()
  filter_nav_menu_options()
  sanitize()
  update()
  filter_nav_menu_options_value()
  amend_customize_save_response()


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
Constructor.

Any supplied $args override class property defaults.

param: WP_Customize_Manager $manager Bootstrap Customizer instance.
param: string               $id      An specific ID of the setting. Can be a
param: array                $args    Optional. Setting arguments.
since: 4.3.0

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

return: array Instance data.
since: 4.3.0

preview()   X-Ref
Handle previewing the setting.

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

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.

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.
since: 4.3.0

_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.

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

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.

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
since: 4.3.0

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

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

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

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

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

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.

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

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

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_otions array.
since: 4.3.0

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

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



Generated: Sun Nov 17 01:00:03 2019 Cross-referenced by PHPXref 0.7.1