Making WordPress.org


Ignore:
Timestamp:
03/05/2021 12:05:23 AM (6 years ago)
Author:
coffee2code
Message:

Handbooks: Use WPorg_Handbook_Init::get_post_types() as the canonical source for obtaining all handbook post types.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/inc/watchlist.php

    r10187 r10768  
    33class WPorg_Handbook_Watchlist {
    44
    5         private static $post_types = array( 'handbook' );
     5        private static $post_types;
    66
    77        public static function init() {
    … …  
    1010
    1111        public static function on_init() {
    12                 self::$post_types = (array) apply_filters( 'handbook_post_types', self::$post_types );
    13                 self::$post_types = array_map( array( __CLASS__, 'append_suffix' ), self::$post_types );
     12                self::$post_types = WPorg_Handbook_Init::get_post_types();
    1413
    1514                add_action( 'p2_action_links', array(__CLASS__, 'display_action_link'), 100 );
    1615                add_filter( 'o2_filter_post_actions', array( __CLASS__, 'add_o2_action_link' ) );
    1716                add_filter( 'o2_filter_post_action_html', array( __CLASS__, 'get_o2_action_link' ), 10, 2 );
    18         }
    19 
    20         /**
    21          * Appends '-handbook' to the dynamic post type, if not already 'handbook'.
    22          *
    23          * @param  string $t Hanbook post type name.
    24          * @return string
    25          */
    26         private static function append_suffix( $t ) {
    27                 if ( in_array( $t, array( 'handbook', 'page' ) ) ) {
    28                         return $t;
    29                 }
    30 
    31                 return $t . '-handbook';
    3217        }
    3318
Note: See TracChangeset for help on using the changeset viewer.