function initialize($feature_args) { if (!is_object($this->element)) { $html_attributes = WP_Metadata::extract_prefixed_args($feature_args, 'html'); $html_attributes['id'] = $this->html_id(); $html_attributes['name'] = $this->html_name(); $html_attributes['class'] = $this->html_class() . (!empty($html_attributes['class']) ? " {$html_attributes['class']}" : ''); $this->element = WP_Metadata::get_html_element($this->html_tag(), $html_attributes); } if (!is_object($this->wrapper)) { $wrapper_attributes = WP_Metadata::extract_prefixed_args($feature_args, 'wrapper_html'); $wrapper_attributes['id'] = $this->wrapper_html_id(); $wrapper_attributes['name'] = $this->wrapper_html_name(); $wrapper_attributes['class'] = $this->wrapper_html_class() . (!empty($wrapper_attributes['class']) ? " {$wrapper_attributes['class']}" : ''); $this->wrapper = WP_Metadata::get_html_element($this->wrapper_tag(), $wrapper_attributes); } }
/** * @param string $view_name * @param array $view_args */ function __construct($view_name, $view_args = array()) { $view_args['view_name'] = $view_name; if (!empty($view_args['field'])) { /* * Set $this->field before parent::__construct() because other initializes depend on it. */ $this->field = $view_args['field']; $this->field->view = $this; } $this->features = array_fill_keys($this->get_feature_types(), array()); parent::__construct($view_args); if (!is_object($this->wrapper)) { $wrapper_attributes = WP_Metadata::extract_prefixed_args($view_args, 'wrapper'); $wrapper_attributes['class'] = $this->wrapper_html_class() . (!empty($wrapper_attributes['class']) ? "{$wrapper_attributes['class']} " : ''); $this->wrapper = WP_Metadata::get_html_element($this->wrapper_tag(), $wrapper_attributes); } }