public function toArray()
    {
        $data = [
            'name' => $this->getName(),
            'text' => $this->getText(),
            'type' => $this->getType(),
            'style' => $this->getStyle(),
        ];

        if($this->getUrl()) $data['url'] = $this->getUrl();
        if($this->getValue()) $data['value'] = $this->getValue();
        if($this->getConfirm()) $data['confirm'] = $this->getConfirm()->toArray();
        if($this->getOptions()) $data['options'] = $this->getOptions();
        if($this->getOptionGroups()) $data['option_groups'] = $this->getOptionGroups();
        if($this->getDataSource()) $data['data_source'] = $this->getDataSource();
        if($this->getSelectedOptions()) $data['selected_options'] = $this->getSelectedOptions();
        if($this->getMinQueryLength()) $data['min_query_length'] = $this->getMinQueryLength();

        return $data;
    }