__construct() public method

Create an instance of WPDKView class
public __construct ( string $id, array | string $class = '' ) : WPDKView
$id string The unique id for this view
$class array | string Optional. The CSS classes for this view
return WPDKView
示例#1
0
 /**
  * Create an instance of WPDKMetaBoxView class
  *
  * @brief Construct
  *
  * @param string        $id            String for use in the 'id' attribute of tags.
  * @param string        $title         Title of the meta box.
  * @param string|object $screen        Optional. The screen on which to show the box (post, page, link). Defaults to current screen.
  * @param string        $context       Optional. The context within the page where the boxes should show ('normal', 'advanced').
  * @param string        $priority      Optional. The priority within the context where the boxes should show ('high', 'low').   *
  * @param mixed         $callback_args Optional. Callable args.
  *
  * @return WPDKMetaBoxView
  */
 public function __construct($id, $title, $screen = null, $context = WPDKMetaBoxContext::ADVANCED, $priority = WPDKMetaBoxPriority::NORMAL, $callback_args = null)
 {
     // TODO The view id must be different from WordPress postbox id, see HTML generate for detail.
     parent::__construct($id);
     // TODO The view id must be different from WordPress postbox id, see HTML generate for detail.
     add_meta_box($id, $title, array($this, 'display'), $screen, $context, $priority, $callback_args);
 }
示例#2
0
 /**
  * Create an instance of WPDKPreferencesView class
  *
  * @brief Construct
  *
  * @param WPDKPreferences $preferences An instance of WPDKPreferences clas
  * @param string          $property    Preferences branch property name
  *
  * @return WPDKPreferencesView
  */
 public function __construct($preferences, $property)
 {
     parent::__construct('wpdk_preferences_view-' . $property);
     // Strore preferences
     $this->preferences = $preferences;
     // Save the branch if exists
     if (!empty($property) && isset($this->preferences->{$property})) {
         $this->branch_property = $property;
         $this->branch = $this->preferences->{$property};
     }
 }
示例#3
0
 /**
  * Create an instance of WPDKUIPageView class
  *
  * @brief Construct
  *
  * @return WPDKUIPageView
  */
 public function __construct()
 {
     parent::__construct(self::ID, 'wpdk-ui-page-view-main-container');
 }
示例#4
0
 /**
  * Create an instance of WPDKHeaderView class
  *
  * @brief Construct
  *
  * @param string $id    The unique id for this view
  * @param string $title The title of this view controller. This is displayed on top header
  *
  * @return WPDKHeaderView
  */
 public function __construct($id, $title = '')
 {
     parent::__construct($id, 'clearfix wpdk-header-view');
     // WPDKHeaderView property
     $this->title = $title;
 }
示例#5
0
 /**
  * Create an instance of WPDKUITableView class
  *
  * @patam string $id The view id.
  *
  * @return WPDKUITableView
  */
 public function __construct($id)
 {
     parent::__construct($id, 'wpdk-ui-table-view');
     // Enqueue component
     WPDKUIComponents::init()->enqueue(WPDKUIComponents::TABLE);
 }
示例#6
0
 /**
  * Create an instance of WPDKjQueryTabsView class
  *
  * @brief Construct
  *
  * @param string $id       The view ID
  * @param array  $tabs     Optional. A tabs list. Instances of WPDKjQueryTab class
  * @param bool   $vertical Optional. Set to TRUE in order to display vertical tab. Default is FALSE.
  *
  * @return WPDKjQueryTabsView
  */
 public function __construct($id, $tabs = array(), $vertical = false)
 {
     parent::__construct($id, 'wpdk-jquery-ui');
     $this->tabs = $tabs;
     $this->vertical = $vertical;
 }
示例#7
0
 /**
  * Create an instance of WPDKDynamicTableView class
  *
  * @brief Construct
  *
  * @param string $id      ID for this dynamic table
  *
  * @return WPDKDynamicTableView
  */
 public function __construct($id)
 {
     parent::__construct($id);
     // Added dynamic
     $this->columns[self::COLUMN_ROW_MANAGE] = '';
     // Enqueue components
     WPDKUIComponents::init()->enqueue(WPDKUIComponents::DYNAMIC_TABLE);
 }