Make WordPress Core

Changeset 26274


Ignore:
Timestamp:
11/19/2013 11:15:07 PM (11 years ago)
Author:
DrewAPicture
Message:

Inline documentation for hooks in wp-admin/edit-tags.php.

Props pauldewouters for the initial patch.
Fixes #25532.

Location:
trunk/src/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/edit-tag-form.php

    r25034 r26274  
    1818
    1919// Back compat hooks
    20 if ( 'category' == $taxonomy )
    21     do_action('edit_category_form_pre', $tag );
    22 elseif ( 'link_category' == $taxonomy )
    23     do_action('edit_link_category_form_pre', $tag );
    24 else
    25     do_action('edit_tag_form_pre', $tag);
    26 
    27 do_action($taxonomy . '_pre_edit_form', $tag, $taxonomy); ?>
     20if ( 'category' == $taxonomy ) {
     21    /** This action is documented in wp-admin/edit-tags.php */
     22    do_action( 'edit_category_form_pre', $tag );
     23} elseif ( 'link_category' == $taxonomy ) {
     24    /** This action is documented in wp-admin/edit-tags.php */
     25    do_action( 'edit_link_category_form_pre', $tag );
     26} else {
     27    /** This action is documented in wp-admin/edit-tags.php */
     28    do_action( 'edit_tag_form_pre', $tag );
     29}
     30/** This action is documented in wp-admin/edit-tags.php */
     31do_action( "{$taxonomy}_pre_edit_form", $tag, $taxonomy ); ?>
    2832
    2933<div class="wrap">
  • trunk/src/wp-admin/edit-tags.php

    r25616 r26274  
    282282);
    283283
     284/**
     285 * Filter the messages displayed when a tag is updated.
     286 *
     287 * @since 3.7.0
     288 *
     289 * @param array $messages The messages to be displayed.
     290 */
    284291$messages = apply_filters( 'term_updated_messages', $messages );
    285292
     
    341348</div>
    342349<?php endif;
    343 do_action('after-' . $taxonomy . '-table', $taxonomy);
     350
     351/**
     352 * Fires after the taxonomy list table.
     353 *
     354 * The dynamic portion of the hook name, $taxonomy, refers to the taxonomy slug.
     355 *
     356 * @since 3.0.0
     357 *
     358 * @param string $taxonomy The taxonomy name.
     359 */
     360do_action( "after-{$taxonomy}-table", $taxonomy );
    344361?>
    345362
     
    369386
    370387if ( current_user_can($tax->cap->edit_terms) ) {
    371     // Back compat hooks. Deprecated in preference to {$taxonomy}_pre_add_form
    372     if ( 'category' == $taxonomy )
    373         do_action('add_category_form_pre', (object)array('parent' => 0) );
    374     elseif ( 'link_category' == $taxonomy )
    375         do_action('add_link_category_form_pre', (object)array('parent' => 0) );
    376     else
    377         do_action('add_tag_form_pre', $taxonomy);
    378 
    379     do_action($taxonomy . '_pre_add_form', $taxonomy);
     388    if ( 'category' == $taxonomy ) {
     389        /**
     390         * Fires before the Add Category form.
     391         *
     392         * @since 2.1.0
     393         * @deprecated 3.0.0 Use {$taxonomy}_pre_add_form instead.
     394         *
     395         * @param object $arg Optional arguments cast to an object.
     396         */
     397        do_action( 'add_category_form_pre', (object) array( 'parent' => 0 ) );
     398    } elseif ( 'link_category' == $taxonomy ) {
     399        /**
     400         * Fires before the link category form.
     401         *
     402         * @since 2.3.0
     403         * @deprecated 3.0.0 Use {$taxonomy}_pre_add_form instead.
     404         *
     405         * @param object $arg Optional arguments cast to an object.
     406         */
     407        do_action( 'add_link_category_form_pre', (object) array( 'parent' => 0 ) );
     408    } else {
     409        /**
     410         * Fires before the Add Tag form.
     411         *
     412         * @since 2.5.0
     413         * @deprecated 3.0.0 Use {$taxonomy}_pre_add_form instead.
     414         *
     415         * @param string $taxonomy The taxonomy slug.
     416         */
     417        do_action( 'add_tag_form_pre', $taxonomy );
     418    }
     419
     420    /**
     421     * Fires before the Add Term form for all taxonomies.
     422     *
     423     * The dynamic portion of the hook name, $taxonomy, refers to the taxonomy slug.
     424     *
     425     * @since 3.0.0
     426     *
     427     * @param string $taxonomy The taxonomy slug.
     428     */
     429    do_action( "{$taxonomy}_pre_add_form", $taxonomy );
    380430?>
    381431
    382432<div class="form-wrap">
    383433<h3><?php echo $tax->labels->add_new_item; ?></h3>
    384 <form id="addtag" method="post" action="edit-tags.php" class="validate"<?php do_action( $taxonomy . '_term_new_form_tag' ); ?>>
     434<?php
     435/**
     436 * Fires at the beginning of the Add Tag form.
     437 *
     438 * The dynamic portion of the hook name, $taxonomy, refers to the taxonomy slug.
     439 *
     440 * @since 3.0.0
     441 */
     442?>
     443<form id="addtag" method="post" action="edit-tags.php" class="validate"<?php do_action( "{$taxonomy}_term_new_form_tag" ); ?>>
    385444<input type="hidden" name="action" value="add-tag" />
    386445<input type="hidden" name="screen" value="<?php echo esc_attr($current_screen->id); ?>" />
     
    415474    );
    416475
     476    /**
     477     * Filter the taxonomy parent drop-down on the Edit Term page.
     478     *
     479     * @since 3.7.0
     480     *
     481     * @param array  $dropdown_args {
     482     *     An array of taxonomy parent drop-down arguments.
     483     *
     484     *     @type int|bool $hide_empty       Whether to hide terms not attached to any posts. Default 0|false.
     485     *     @type bool     $hide_if_empty    Whether to hide the drop-down if no terms exist. Default false.
     486     *     @type string   $taxonomy         The taxonomy slug.
     487     *     @type string   $name             Value of the name attribute to use for the drop-down select element.
     488     *                                      Default 'parent'.
     489     *     @type string   $orderby          The field to order by. Default 'name'.
     490     *     @type bool     $hierarchical     Whether the taxonomy is hierarchical. Default true.
     491     *     @type string   $show_option_none Label to display if there are no terms. Default 'None'.
     492     * }
     493     * @param string $taxonomy The taxonomy slug.
     494     */
    417495    $dropdown_args = apply_filters( 'taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy );
    418496    wp_dropdown_categories( $dropdown_args );
     
    430508
    431509<?php
    432 if ( ! is_taxonomy_hierarchical($taxonomy) )
    433     do_action('add_tag_form_fields', $taxonomy);
    434 do_action($taxonomy . '_add_form_fields', $taxonomy);
     510if ( ! is_taxonomy_hierarchical( $taxonomy ) ) {
     511    /**
     512     * Fires after the Add Tag form fields for non-hierarchical taxonomies.
     513     *
     514     * @since 3.0.0
     515     *
     516     * @param string $taxonomy The taxonomy slug.
     517     */
     518    do_action( 'add_tag_form_fields', $taxonomy );
     519}
     520
     521/**
     522 * Fires after the Add Term form fields for hierarchical taxonomies.
     523 *
     524 * The dynamic portion of the hook name, $taxonomy, refers to the taxonomy slug.
     525 *
     526 * @since 3.0.0
     527 *
     528 * @param string $taxonomy The taxonomy slug.
     529 */
     530do_action( "{$taxonomy}_add_form_fields", $taxonomy );
    435531
    436532submit_button( $tax->labels->add_new_item );
    437533
    438 // Back compat hooks. Deprecated in preference to {$taxonomy}_add_form
    439 if ( 'category' == $taxonomy )
    440     do_action('edit_category_form', (object)array('parent' => 0) );
    441 elseif ( 'link_category' == $taxonomy )
    442     do_action('edit_link_category_form', (object)array('parent' => 0) );
    443 else
    444     do_action('add_tag_form', $taxonomy);
    445 
    446 do_action($taxonomy . '_add_form', $taxonomy);
     534if ( 'category' == $taxonomy ) {
     535    /**
     536     * Fires at the end of the Edit Category form.
     537     *
     538     * @since 2.1.0
     539     * @deprecated 3.0.0 Use {$taxonomy}_add_form instead.
     540     *
     541     * @param object $arg Optional arguments cast to an object.
     542     */
     543    do_action( 'edit_category_form', (object) array( 'parent' => 0 ) );
     544} elseif ( 'link_category' == $taxonomy ) {
     545    /**
     546     * Fires at the end of the Edit Link form.
     547     *
     548     * @since 2.3.0
     549     * @deprecated 3.0.0 Use {$taxonomy}_add_form instead.
     550     *
     551     * @param object $arg Optional arguments cast to an object.
     552     */
     553    do_action( 'edit_link_category_form', (object) array( 'parent' => 0 ) );
     554} else {
     555    /**
     556     * Fires at the end of the Add Tag form.
     557     *
     558     * @since 2.7.0
     559     * @deprecated 3.0.0 Use {$taxonomy}_add_form instead.
     560     *
     561     * @param string $taxonomy The taxonomy slug.
     562     */
     563    do_action( 'add_tag_form', $taxonomy );
     564}
     565
     566/**
     567 * Fires at the end of the Add Term form for all taxonomies.
     568 *
     569 * The dynamic portion of the hook name, $taxonomy, refers to the taxonomy slug.
     570 *
     571 * @since 3.0.0
     572 *
     573 * @param string $taxonomy The taxonomy slug.
     574 */
     575do_action( "{$taxonomy}_add_form", $taxonomy );
    447576?>
    448577</form></div>
Note: See TracChangeset for help on using the changeset viewer.