Inline documentation for hooks in wp-admin/includes/nav-menu.php.

Props Faison.
Fixes #25474.

Built from https://develop.svn.wordpress.org/trunk@25935


git-svn-id: http://core.svn.wordpress.org/trunk@25894 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Drew Jaynes 2013-10-26 17:48:11 +00:00
parent 3c22a3fd6d
commit 94a3ee8d68
1 changed files with 45 additions and 1 deletions

View File

@ -503,6 +503,16 @@ function wp_nav_menu_post_type_meta_boxes() {
return; return;
foreach ( $post_types as $post_type ) { foreach ( $post_types as $post_type ) {
/**
* Filter whether a menu items meta box will be added for the current post type.
*
* If a falsey value is returned instead of a post type object,
* the post type menu items meta box will not be added.
*
* @since 3.0.0
*
* @param object $post_type The post type object to be used as a meta box.
*/
$post_type = apply_filters( 'nav_menu_meta_box_object', $post_type ); $post_type = apply_filters( 'nav_menu_meta_box_object', $post_type );
if ( $post_type ) { if ( $post_type ) {
$id = $post_type->name; $id = $post_type->name;
@ -525,6 +535,16 @@ function wp_nav_menu_taxonomy_meta_boxes() {
return; return;
foreach ( $taxonomies as $tax ) { foreach ( $taxonomies as $tax ) {
/**
* Filter whether a menu items meta box will be added for the current taxonomy.
*
* If a falsey value is returned instead of a taxonomy object,
* the taxonomy menu items meta box will not be added.
*
* @since 3.0.0
*
* @param object $tax The taxonomy object to be used as a meta box.
*/
$tax = apply_filters( 'nav_menu_meta_box_object', $tax ); $tax = apply_filters( 'nav_menu_meta_box_object', $tax );
if ( $tax ) { if ( $tax ) {
$id = $tax->name; $id = $tax->name;
@ -780,7 +800,22 @@ function wp_nav_menu_item_post_type_meta_box( $object, $post_type ) {
} }
} }
$posts = apply_filters( 'nav_menu_items_'.$post_type_name, $posts, $args, $post_type ); /**
* Filter the posts displayed in the 'View All' tab of the current
* post type's menu items meta box.
*
* The dynamic portion of the hook name, $post_type_name,
* refers to the slug of the current post type.
*
* @since 3.2.0
*
* @see WP_Query::query()
*
* @param array $posts The posts for the current post type.
* @param array $args An array of WP_Query arguments.
* @param object $post_type The current post type object for this menu item meta box.
*/
$posts = apply_filters( "nav_menu_items_{$post_type_name}", $posts, $args, $post_type );
$checkbox_items = walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $posts), 0, (object) $args ); $checkbox_items = walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $posts), 0, (object) $args );
if ( 'all' == $current_tab && ! empty( $_REQUEST['selectall'] ) ) { if ( 'all' == $current_tab && ! empty( $_REQUEST['selectall'] ) ) {
@ -1137,6 +1172,14 @@ function wp_get_nav_menu_to_edit( $menu_id = 0 ) {
if( empty($menu_items) ) if( empty($menu_items) )
return $result . ' <ul class="menu" id="menu-to-edit"> </ul>'; return $result . ' <ul class="menu" id="menu-to-edit"> </ul>';
/**
* Filter the Walker class used to render a menu formatted for editing.
*
* @since 3.0.0
*
* @param string $walker_class_name The Walker class used to render a menu formatted for editing.
* @param int $menu_id The ID of the menu being rendered.
*/
$walker_class_name = apply_filters( 'wp_edit_nav_menu_walker', 'Walker_Nav_Menu_Edit', $menu_id ); $walker_class_name = apply_filters( 'wp_edit_nav_menu_walker', 'Walker_Nav_Menu_Edit', $menu_id );
if ( class_exists( $walker_class_name ) ) if ( class_exists( $walker_class_name ) )
@ -1281,6 +1324,7 @@ function wp_nav_menu_update_menu_items ( $nav_menu_selected_id, $nav_menu_select
wp_defer_term_counting( false ); wp_defer_term_counting( false );
/** This action is documented in wp-includes/nav-menu.php */
do_action( 'wp_update_nav_menu', $nav_menu_selected_id ); do_action( 'wp_update_nav_menu', $nav_menu_selected_id );
$messages[] = '<div id="message" class="updated"><p>' . sprintf( __( '<strong>%1$s</strong> has been updated.' ), $nav_menu_selected_title ) . '</p></div>'; $messages[] = '<div id="message" class="updated"><p>' . sprintf( __( '<strong>%1$s</strong> has been updated.' ), $nav_menu_selected_title ) . '</p></div>';