id = $id; $this->title = $title; $this->set($args); } /** * Set configuration data for the component * * @param array $args Configuration params * */ public function set($args) { foreach ($args as $prop => $value) { if (property_exists($this, $prop)) { $this->{$prop} = $value; } } return $this; } /** * Convert the object into an assoc array ready to be json_encoded * and passed to the UI component * * @return array Configuration data */ public function getConfig() { $config = [ 'description' => $this->description, 'expanded' => $this->expanded, 'headingLevel' => $this->headingLevel, 'id' => $this->id, 'isSidebarVisible' => $this->isSidebarVisible, 'items' => $this->items, 'title' => $this->title, ]; if (strlen($this->emptyLabel)) { $config['emptyLabel'] = $this->emptyLabel; } if (!empty($this->getParams)) { $config['getParams'] = $this->getParams; } return $config; } }