Changeset 12259
- Timestamp:
- 11/22/2022 12:50:46 AM (4 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-learn/inc
- Files:
-
- 2 edited
-
admin.php (modified) (3 diffs)
-
taxonomy.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-learn/inc/admin.php
r12192 r12259 15 15 add_action( 'admin_notices', __NAMESPACE__ . '\show_term_translation_notice' ); 16 16 add_filter( 'manage_wporg_workshop_posts_columns', __NAMESPACE__ . '\add_workshop_list_table_columns' ); 17 add_filter( 'manage_edit-topic_columns', __NAMESPACE__ . '\add_topic_list_table_column' ); 17 18 foreach ( array( 'lesson-plan', 'meeting', 'course', 'lesson' ) as $pt ) { 18 19 add_filter( 'manage_' . $pt . '_posts_columns', __NAMESPACE__ . '\add_list_table_language_column' ); 19 20 } 20 21 add_action( 'manage_wporg_workshop_posts_custom_column', __NAMESPACE__ . '\render_workshop_list_table_columns', 10, 2 ); 22 add_action( 'manage_topic_custom_column', __NAMESPACE__ . '\render_topics_list_table_columns', 10, 3 ); 21 23 foreach ( array( 'lesson-plan', 'meeting', 'course', 'lesson' ) as $pt ) { 22 24 add_filter( 'manage_' . $pt . '_posts_custom_column', __NAMESPACE__ . '\render_list_table_language_column', 10, 2 ); … … 98 100 99 101 /** 102 * Add additional columns to the terms list table for topics. 103 * 104 * @param array $columns 105 * 106 * @return array 107 */ 108 function add_topic_list_table_column( $columns ) { 109 $columns = array_slice( $columns, 0, -1, true ) 110 + array( 'icon' => __( 'Icon', 'wporg-learn' ) ) 111 + array( 'sticky' => __( 'Sticky', 'wporg-learn' ) ) 112 + array_slice( $columns, -1, 1, true ); 113 114 return $columns; 115 } 116 117 /** 100 118 * Add a language column to the post list table. 101 119 * … … 152 170 ) 153 171 ) ); 172 break; 173 } 174 } 175 176 /** 177 * Render the cell contents for the additional columns in the terms list table for topics. 178 * 179 * @param string $content 180 * @param string $column_name 181 * @param int $term_id 182 * 183 * @return void 184 */ 185 function render_topics_list_table_columns( $content, $column_name, $term_id ) { 186 switch ( $column_name ) { 187 case 'icon': 188 $icon = get_term_meta( $term_id, 'dashicon-class', true ); 189 190 echo esc_html( $icon ); 191 break; 192 case 'sticky': 193 $sticky = get_term_meta( $term_id, 'sticky', true ); 194 195 echo $sticky ? '<span class="dashicons dashicons-sticky"></span>' : ''; 154 196 break; 155 197 } -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-learn/inc/taxonomy.php
r12174 r12259 9 9 */ 10 10 add_action( 'init', __NAMESPACE__ . '\register' ); 11 add_action( 'audience_add_form_fields', __NAMESPACE__ . '\register_custom_fields' ); 12 add_action( 'wporg_lesson_category_add_form_fields', __NAMESPACE__ . '\register_custom_fields' ); 13 add_action( 'topic_add_form_fields', __NAMESPACE__ . '\register_custom_fields' ); 14 add_action( 'audience_edit_form_fields', __NAMESPACE__ . '\tax_edit_term_fields', 10, 2 ); 15 add_action( 'wporg_lesson_category_edit_form_fields', __NAMESPACE__ . '\tax_edit_term_fields', 10, 2 ); 16 add_action( 'topic_edit_form_fields', __NAMESPACE__ . '\tax_edit_term_fields', 10, 2 ); 17 add_action( 'created_audience', __NAMESPACE__ . '\tax_save_term_fields' ); 18 add_action( 'edited_audience', __NAMESPACE__ . '\tax_save_term_fields' ); 19 add_action( 'created_wporg_lesson_category', __NAMESPACE__ . '\tax_save_term_fields' ); 20 add_action( 'edited_wporg_lesson_category', __NAMESPACE__ . '\tax_save_term_fields' ); 21 add_action( 'created_topic', __NAMESPACE__ . '\tax_save_term_fields' ); 22 add_action( 'edited_topic', __NAMESPACE__ . '\tax_save_term_fields' ); 11 23 12 24 /** … … 584 596 } 585 597 586 add_action( 'audience_add_form_fields', __NAMESPACE__ . '\register_custom_fields' );587 add_action( 'wporg_lesson_category_add_form_fields', __NAMESPACE__ . '\register_custom_fields' );588 589 598 /** 590 599 * Icon field on edit screen. … … 594 603 */ 595 604 function tax_edit_term_fields( $term, $taxonomy ) { 596 $value = get_term_meta( $term->term_id, 'dashicon-class', true );605 $value = get_term_meta( $term->term_id, 'dashicon-class', true ); 597 606 $sticky = get_term_meta( $term->term_id, 'sticky', true ); 598 607 … … 618 627 } 619 628 620 add_action( 'audience_edit_form_fields', __NAMESPACE__ . '\tax_edit_term_fields', 10, 2 );621 add_action( 'wporg_lesson_category_edit_form_fields', __NAMESPACE__ . '\tax_edit_term_fields', 10, 2 );622 623 629 /** 624 630 * Save icon field. … … 648 654 ); 649 655 } 650 651 add_action( 'created_audience', __NAMESPACE__ . '\tax_save_term_fields' );652 add_action( 'edited_audience', __NAMESPACE__ . '\tax_save_term_fields' );653 add_action( 'created_wporg_lesson_category', __NAMESPACE__ . '\tax_save_term_fields' );654 add_action( 'edited_wporg_lesson_category', __NAMESPACE__ . '\tax_save_term_fields' );
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)