[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

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

Customize API: WP_Customize_Nav_Menu_Item_Setting class

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

Defines 1 class

WP_Customize_Nav_Menu_Item_Setting:: (13 methods):
  __construct()
  flush_cached_value()
  value()
  get_original_title()
  get_type_label()
  populate_value()
  preview()
  filter_wp_get_nav_menu_items()
  sort_wp_get_nav_menu_items()
  value_as_wp_post_nav_menu_item()
  sanitize()
  update()
  amend_customize_save_response()


Class: WP_Customize_Nav_Menu_Item_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.

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

flush_cached_value( $menu_id, $menu_item_id )   X-Ref
Clear the cached value when this nav menu item is updated.

since: 4.3.0
param: int $menu_id       The term ID for the menu.
param: int $menu_item_id  The post ID for the menu item.

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

since: 4.3.0
return: array|false Instance data array, or false if the item is marked for deletion.

get_original_title( $item )   X-Ref
Get original title.

since: 4.7.0
param: object $item Nav menu item.
return: string The original title.

get_type_label( $item )   X-Ref
Get type label.

returns: string The type label.
since: 4.7.0
param: object $item Nav menu item.

populate_value()   X-Ref
Ensure that the value is fully populated with the necessary properties.

Translates some properties added by wp_setup_nav_menu_item() and removes others.

since: 4.3.0

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_menu_items( $items, $menu, $args )   X-Ref
Filters the wp_get_nav_menu_items() result to supply the previewed menu items.

since: 4.3.0
param: WP_Post[] $items An array of menu item post objects.
param: WP_Term   $menu  The menu object.
param: array     $args  An array of arguments used to retrieve menu item objects.
return: WP_Post[] Array of menu item objects.

sort_wp_get_nav_menu_items( $items, $menu, $args )   X-Ref
Re-apply the tail logic also applied on $items by wp_get_nav_menu_items().

since: 4.3.0
param: WP_Post[] $items An array of menu item post objects.
param: WP_Term   $menu  The menu object.
param: array     $args  An array of arguments used to retrieve menu item objects.
return: WP_Post[] Array of menu item objects.

value_as_wp_post_nav_menu_item()   X-Ref
Get the value emulated into a WP_Post and set up as a nav_menu_item.

since: 4.3.0
return: WP_Post With wp_setup_nav_menu_item() applied.

sanitize( $menu_item_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 $menu_item_value The value to sanitize.
return: array|false|null|WP_Error Null or WP_Error if an input isn't valid. False if it is marked for deletion.

update( $value )   X-Ref
Creates/updates the nav_menu_item post for this setting.

Any created menu items will have their assigned post 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 The menu item array to update. If false, then the menu item will be deleted
return: null|void

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 Save response data.



Generated: Mon Nov 18 01:00:04 2019 Cross-referenced by PHPXref 0.7.1