Making WordPress.org

Changeset 2565


Ignore:
Timestamp:
02/24/2016 06:16:35 PM (11 years ago)
Author:
coffee2code
Message:

Handbook plugin: Store widget id base as a static class variable and add accessor (get_widget_id_base()) for it.

File:
1 edited

Legend:

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

    r1729 r2565  
    33class WPorg_Handbook_Pages_Widget extends WP_Widget_Pages {
    44
     5        /**
     6         * Base ID for the widget.
     7         *
     8         * @access protected
     9         * @var string
     10         */
     11        protected static $widget_id_base = 'handbook_pages';
     12
    513        protected $post_types = array( 'handbook' );
     14
     15        /**
     16         * Gets the widget_id_base value.
     17         *
     18         * @return string
     19         */
     20        public static function get_widget_id_base() {
     21                return self::$widget_id_base;
     22        }
    623
    724        function __construct() {
    825                $widget_ops = array('classname' => 'widget_wporg_handbook_pages', 'description' => __( 'Your site’s Handbook Pages', 'wporg' ) );
    9                 WP_Widget::__construct( 'handbook_pages', __( 'Handbook Pages', 'wporg' ), $widget_ops );
     26                WP_Widget::__construct( self::get_widget_id_base(), __( 'Handbook Pages', 'wporg' ), $widget_ops );
    1027        }
    1128
Note: See TracChangeset for help on using the changeset viewer.