WPDKView::__construct PHP Method

__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
    public function __construct($id, $class = '')
    {
        $this->id = sanitize_title($id);
        $this->class = WPDKHtmlTag::sanitizeClasses($class);
        $this->content = '';
        $this->superview = null;
        $this->subviews = array();
    }

Usage Example

Example #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);
 }
All Usage Examples Of WPDKView::__construct