wp/wp-admin/edit-tag-form.php
changeset 5 5e2f62d02dcd
parent 0 d970ebf37754
child 7 cf61fcea0001
equal deleted inserted replaced
4:346c88efed21 5:5e2f62d02dcd
     9 // don't load directly
     9 // don't load directly
    10 if ( !defined('ABSPATH') )
    10 if ( !defined('ABSPATH') )
    11 	die('-1');
    11 	die('-1');
    12 
    12 
    13 if ( empty($tag_ID) ) { ?>
    13 if ( empty($tag_ID) ) { ?>
    14 	<div id="message" class="updated"><p><strong><?php _e( 'You did not select an item for editing.' ); ?></strong></p></div>
    14 	<div id="message" class="updated notice is-dismissible"><p><strong><?php _e( 'You did not select an item for editing.' ); ?></strong></p></div>
    15 <?php
    15 <?php
    16 	return;
    16 	return;
    17 }
    17 }
    18 
    18 
    19 // Back compat hooks
    19 // Back compat hooks
    20 if ( 'category' == $taxonomy )
    20 if ( 'category' == $taxonomy ) {
    21 	do_action('edit_category_form_pre', $tag );
    21 	/**
    22 elseif ( 'link_category' == $taxonomy )
    22  	 * Fires before the Edit Category form.
    23 	do_action('edit_link_category_form_pre', $tag );
    23 	 *
    24 else
    24 	 * @since 2.1.0
    25 	do_action('edit_tag_form_pre', $tag);
    25 	 * @deprecated 3.0.0 Use {$taxonomy}_pre_edit_form instead.
    26 
    26 	 *
    27 do_action($taxonomy . '_pre_edit_form', $tag, $taxonomy); ?>
    27 	 * @param object $tag Current category term object.
       
    28 	 */
       
    29 	do_action( 'edit_category_form_pre', $tag );
       
    30 } elseif ( 'link_category' == $taxonomy ) {
       
    31 	/**
       
    32 	 * Fires before the Edit Link Category form.
       
    33 	 *
       
    34 	 * @since 2.3.0
       
    35 	 * @deprecated 3.0.0 Use {$taxonomy}_pre_edit_form instead.
       
    36 	 *
       
    37 	 * @param object $tag Current link category term object.
       
    38 	 */
       
    39 	do_action( 'edit_link_category_form_pre', $tag );
       
    40 } else {
       
    41 	/**
       
    42 	 * Fires before the Edit Tag form.
       
    43 	 *
       
    44 	 * @since 2.5.0
       
    45 	 * @deprecated 3.0.0 Use {$taxonomy}_pre_edit_form instead.
       
    46 	 *
       
    47 	 * @param object $tag Current tag term object.
       
    48 	 */
       
    49 	do_action( 'edit_tag_form_pre', $tag );
       
    50 }
       
    51 /**
       
    52  * Fires before the Edit Term form for all taxonomies.
       
    53  *
       
    54  * The dynamic portion of the hook name, `$taxonomy`, refers to
       
    55  * the taxonomy slug.
       
    56  *
       
    57  * @since 3.0.0
       
    58  *
       
    59  * @param object $tag      Current taxonomy term object.
       
    60  * @param string $taxonomy Current $taxonomy slug.
       
    61  */
       
    62 do_action( "{$taxonomy}_pre_edit_form", $tag, $taxonomy ); ?>
    28 
    63 
    29 <div class="wrap">
    64 <div class="wrap">
    30 <?php screen_icon(); ?>
       
    31 <h2><?php echo $tax->labels->edit_item; ?></h2>
    65 <h2><?php echo $tax->labels->edit_item; ?></h2>
    32 <div id="ajax-response"></div>
    66 <div id="ajax-response"></div>
    33 <form name="edittag" id="edittag" method="post" action="edit-tags.php" class="validate"<?php do_action( $taxonomy . '_term_edit_form_tag' ); ?>>
    67 <form name="edittag" id="edittag" method="post" action="edit-tags.php" class="validate"
       
    68 <?php
       
    69 /**
       
    70  * Fires inside the Edit Term form tag.
       
    71  *
       
    72  * The dynamic portion of the hook name, `$taxonomy`, refers to
       
    73  * the taxonomy slug.
       
    74  *
       
    75  * @since 3.7.0
       
    76  */
       
    77 do_action( "{$taxonomy}_term_edit_form_tag" );
       
    78 ?>>
    34 <input type="hidden" name="action" value="editedtag" />
    79 <input type="hidden" name="action" value="editedtag" />
    35 <input type="hidden" name="tag_ID" value="<?php echo esc_attr($tag->term_id) ?>" />
    80 <input type="hidden" name="tag_ID" value="<?php echo esc_attr($tag->term_id) ?>" />
    36 <input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy) ?>" />
    81 <input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy) ?>" />
    37 <?php wp_original_referer_field(true, 'previous'); wp_nonce_field('update-tag_' . $tag_ID); ?>
    82 <?php wp_original_referer_field(true, 'previous'); wp_nonce_field('update-tag_' . $tag_ID); ?>
    38 	<table class="form-table">
    83 	<table class="form-table">
    39 		<tr class="form-field form-required">
    84 		<tr class="form-field form-required term-name-wrap">
    40 			<th scope="row" valign="top"><label for="name"><?php _ex('Name', 'Taxonomy Name'); ?></label></th>
    85 			<th scope="row"><label for="name"><?php _ex( 'Name', 'term name' ); ?></label></th>
    41 			<td><input name="name" id="name" type="text" value="<?php if ( isset( $tag->name ) ) echo esc_attr($tag->name); ?>" size="40" aria-required="true" />
    86 			<td><input name="name" id="name" type="text" value="<?php if ( isset( $tag->name ) ) echo esc_attr($tag->name); ?>" size="40" aria-required="true" />
    42 			<p class="description"><?php _e('The name is how it appears on your site.'); ?></p></td>
    87 			<p class="description"><?php _e('The name is how it appears on your site.'); ?></p></td>
    43 		</tr>
    88 		</tr>
    44 <?php if ( !global_terms_enabled() ) { ?>
    89 <?php if ( !global_terms_enabled() ) { ?>
    45 		<tr class="form-field">
    90 		<tr class="form-field term-slug-wrap">
    46 			<th scope="row" valign="top"><label for="slug"><?php _ex('Slug', 'Taxonomy Slug'); ?></label></th>
    91 			<th scope="row"><label for="slug"><?php _e( 'Slug' ); ?></label></th>
    47 			<td><input name="slug" id="slug" type="text" value="<?php if ( isset( $tag->slug ) ) echo esc_attr(apply_filters('editable_slug', $tag->slug)); ?>" size="40" />
    92 			<?php
       
    93 			/**
       
    94 			 * Filter the editable slug.
       
    95 			 *
       
    96 			 * Note: This is a multi-use hook in that it is leveraged both for editable
       
    97 			 * post URIs and term slugs.
       
    98 			 *
       
    99 			 * @since 2.6.0
       
   100 			 *
       
   101 			 * @param string $slug The editable slug. Will be either a term slug or post URI depending
       
   102 			 *                     upon the context in which it is evaluated.
       
   103 			 */
       
   104 			$slug = isset( $tag->slug ) ? apply_filters( 'editable_slug', $tag->slug ) : '';
       
   105 			?>
       
   106 			<td><input name="slug" id="slug" type="text" value="<?php echo esc_attr( $slug ); ?>" size="40" />
    48 			<p class="description"><?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p></td>
   107 			<p class="description"><?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p></td>
    49 		</tr>
   108 		</tr>
    50 <?php } ?>
   109 <?php } ?>
    51 <?php if ( is_taxonomy_hierarchical($taxonomy) ) : ?>
   110 <?php if ( is_taxonomy_hierarchical($taxonomy) ) : ?>
    52 		<tr class="form-field">
   111 		<tr class="form-field term-parent-wrap">
    53 			<th scope="row" valign="top"><label for="parent"><?php _ex('Parent', 'Taxonomy Parent'); ?></label></th>
   112 			<th scope="row"><label for="parent"><?php _ex( 'Parent', 'term parent' ); ?></label></th>
    54 			<td>
   113 			<td>
    55 				<?php wp_dropdown_categories(array('hide_empty' => 0, 'hide_if_empty' => false, 'name' => 'parent', 'orderby' => 'name', 'taxonomy' => $taxonomy, 'selected' => $tag->parent, 'exclude_tree' => $tag->term_id, 'hierarchical' => true, 'show_option_none' => __('None'))); ?>
   114 				<?php
       
   115 				$dropdown_args = array(
       
   116 					'hide_empty'       => 0,
       
   117 					'hide_if_empty'    => false,
       
   118 					'taxonomy'         => $taxonomy,
       
   119 					'name'             => 'parent',
       
   120 					'orderby'          => 'name',
       
   121 					'selected'         => $tag->parent,
       
   122 					'exclude_tree'     => $tag->term_id,
       
   123 					'hierarchical'     => true,
       
   124 					'show_option_none' => __( 'None' ),
       
   125 				);
       
   126 
       
   127 				/** This filter is documented in wp-admin/edit-tags.php */
       
   128 				$dropdown_args = apply_filters( 'taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy, 'edit' );
       
   129 				wp_dropdown_categories( $dropdown_args ); ?>
    56 				<?php if ( 'category' == $taxonomy ) : ?>
   130 				<?php if ( 'category' == $taxonomy ) : ?>
    57 				<p class="description"><?php _e('Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional.'); ?></p>
   131 				<p class="description"><?php _e('Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional.'); ?></p>
    58 				<?php endif; ?>
   132 				<?php endif; ?>
    59 			</td>
   133 			</td>
    60 		</tr>
   134 		</tr>
    61 <?php endif; // is_taxonomy_hierarchical() ?>
   135 <?php endif; // is_taxonomy_hierarchical() ?>
    62 		<tr class="form-field">
   136 		<tr class="form-field term-description-wrap">
    63 			<th scope="row" valign="top"><label for="description"><?php _ex('Description', 'Taxonomy Description'); ?></label></th>
   137 			<th scope="row"><label for="description"><?php _e( 'Description' ); ?></label></th>
    64 			<td><textarea name="description" id="description" rows="5" cols="50" class="large-text"><?php echo $tag->description; // textarea_escaped ?></textarea><br />
   138 			<td><textarea name="description" id="description" rows="5" cols="50" class="large-text"><?php echo $tag->description; // textarea_escaped ?></textarea>
    65 			<span class="description"><?php _e('The description is not prominent by default; however, some themes may show it.'); ?></span></td>
   139 			<p class="description"><?php _e('The description is not prominent by default; however, some themes may show it.'); ?></p></td>
    66 		</tr>
   140 		</tr>
    67 		<?php
   141 		<?php
    68 		// Back compat hooks
   142 		// Back compat hooks
    69 		if ( 'category' == $taxonomy )
   143 		if ( 'category' == $taxonomy ) {
    70 			do_action('edit_category_form_fields', $tag);
   144 			/**
    71 		elseif ( 'link_category' == $taxonomy )
   145 			 * Fires after the Edit Category form fields are displayed.
    72 			do_action('edit_link_category_form_fields', $tag);
   146 			 *
    73 		else
   147 			 * @since 2.9.0
    74 			do_action('edit_tag_form_fields', $tag);
   148 			 * @deprecated 3.0.0 Use {$taxonomy}_edit_form_fields instead.
    75 
   149 			 *
    76 		do_action($taxonomy . '_edit_form_fields', $tag, $taxonomy);
   150 			 * @param object $tag Current category term object.
       
   151 			 */
       
   152 			do_action( 'edit_category_form_fields', $tag );
       
   153 		} elseif ( 'link_category' == $taxonomy ) {
       
   154 			/**
       
   155 			 * Fires after the Edit Link Category form fields are displayed.
       
   156 			 *
       
   157 			 * @since 2.9.0
       
   158 			 * @deprecated 3.0.0 Use {$taxonomy}_edit_form_fields instead.
       
   159 			 *
       
   160 			 * @param object $tag Current link category term object.
       
   161 			 */
       
   162 			do_action( 'edit_link_category_form_fields', $tag );
       
   163 		} else {
       
   164 			/**
       
   165 			 * Fires after the Edit Tag form fields are displayed.
       
   166 			 *
       
   167 			 * @since 2.9.0
       
   168 			 * @deprecated 3.0.0 Use {$taxonomy}_edit_form_fields instead.
       
   169 			 *
       
   170 			 * @param object $tag Current tag term object.
       
   171 			 */
       
   172 			do_action( 'edit_tag_form_fields', $tag );
       
   173 		}
       
   174 		/**
       
   175 		 * Fires after the Edit Term form fields are displayed.
       
   176 		 *
       
   177 		 * The dynamic portion of the hook name, `$taxonomy`, refers to
       
   178 		 * the taxonomy slug.
       
   179 		 *
       
   180 		 * @since 3.0.0
       
   181 		 *
       
   182 		 * @param object $tag      Current taxonomy term object.
       
   183 		 * @param string $taxonomy Current taxonomy slug.
       
   184 		 */
       
   185 		do_action( "{$taxonomy}_edit_form_fields", $tag, $taxonomy );
    77 		?>
   186 		?>
    78 	</table>
   187 	</table>
    79 <?php
   188 <?php
    80 // Back compat hooks
   189 // Back compat hooks
    81 if ( 'category' == $taxonomy )
   190 if ( 'category' == $taxonomy ) {
    82 	do_action('edit_category_form', $tag);
   191 	/** This action is documented in wp-admin/edit-tags.php */
    83 elseif ( 'link_category' == $taxonomy )
   192 	do_action( 'edit_category_form', $tag );
    84 	do_action('edit_link_category_form', $tag);
   193 } elseif ( 'link_category' == $taxonomy ) {
    85 else
   194 	/** This action is documented in wp-admin/edit-tags.php */
    86 	do_action('edit_tag_form', $tag);
   195 	do_action( 'edit_link_category_form', $tag );
    87 
   196 } else {
    88 do_action($taxonomy . '_edit_form', $tag, $taxonomy);
   197 	/**
       
   198 	 * Fires at the end of the Edit Term form.
       
   199 	 *
       
   200 	 * @since 2.5.0
       
   201 	 * @deprecated 3.0.0 Use {$taxonomy}_edit_form instead.
       
   202 	 *
       
   203 	 * @param object $tag Current taxonomy term object.
       
   204 	 */
       
   205 	do_action( 'edit_tag_form', $tag );
       
   206 }
       
   207 /**
       
   208  * Fires at the end of the Edit Term form for all taxonomies.
       
   209  *
       
   210  * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
       
   211  *
       
   212  * @since 3.0.0
       
   213  *
       
   214  * @param object $tag      Current taxonomy term object.
       
   215  * @param string $taxonomy Current taxonomy slug.
       
   216  */
       
   217 do_action( "{$taxonomy}_edit_form", $tag, $taxonomy );
    89 
   218 
    90 submit_button( __('Update') );
   219 submit_button( __('Update') );
    91 ?>
   220 ?>
    92 </form>
   221 </form>
    93 </div>
   222 </div>
       
   223 
       
   224 <?php if ( ! wp_is_mobile() ) : ?>
    94 <script type="text/javascript">
   225 <script type="text/javascript">
    95 try{document.forms.edittag.name.focus();}catch(e){}
   226 try{document.forms.edittag.name.focus();}catch(e){}
    96 </script>
   227 </script>
       
   228 <?php endif;