Changeset 2372
- Timestamp:
- 01/26/2016 08:15:53 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/explanations.php
r2153 r2372 41 41 add_action( 'edit_form_after_title', array( $this, 'post_to_expl_controls' ) ); 42 42 add_action( 'edit_form_top', array( $this, 'expl_to_post_controls' ) ); 43 add_action( 'admin_bar_menu', array( $this, 'toolbar_edit_link' ), 100 ); 43 44 44 45 // Script and styles. … … 171 172 172 173 /** 174 * Adds an 'Edit Explanation' link to the Toolbar on parsed post type single pages. 175 * 176 * @access public 177 * 178 * @param WP_Admin_Bar $wp_admin_bar WP_Admin_Bar instance. 179 */ 180 public function toolbar_edit_link( $wp_admin_bar ) { 181 global $wp_the_query; 182 183 $screen = $wp_the_query->get_queried_object(); 184 185 if ( is_admin() || empty( $screen->post_type ) || ! is_singular( $this->post_types ) ) { 186 return; 187 } 188 189 if ( ! empty( $screen->post_type ) ) { 190 // Proceed only if there's an explanation for the current reference post type. 191 if ( $explanation = \DevHub\get_explanation( $screen ) ) { 192 $post_type = get_post_type_object( $this->exp_post_type ); 193 194 $wp_admin_bar->add_menu( array( 195 'id' => 'edit-explanation', 196 'title' => $post_type->labels->edit_item, 197 'href' => get_edit_post_link( $explanation ) 198 ) ); 199 } 200 } 201 } 202 203 /** 173 204 * Output the Explanation status controls. 174 205 *
Note: See TracChangeset
for help on using the changeset viewer.