protected $_ajax = true;
protected $_allowsHTML = false;
+ protected $_excludedOptions = [];
+
protected $_showSeletedOption = false;
public function getDefaultAttributes()
{
- return array_merge(parent::getDefaultAttributes(), ['options' => $this->getOptions(), 'options_aliases' => $this->_options_aliases, 'allows_null' => $this->_allowNull, 'allows_multiple' => $this->_multiple, 'ajax' => $this->_ajax, 'allows_html' => $this->_allowsHTML, 'show_selected_option' => $this->_showSeletedOption]);
+ return array_merge(parent::getDefaultAttributes(), [
+ 'options' => $this->getOptionsFiltered(),
+ 'excluded_options' => $this->_excludedOptions,
+ 'options_aliases' => $this->_options_aliases,
+ 'allows_null' => $this->_allowNull,
+ 'allows_multiple' => $this->_multiple,
+ 'ajax' => $this->_ajax,
+ 'allows_html' => $this->_allowsHTML,
+ 'show_selected_option' => $this->_showSeletedOption
+ ]);
}
protected function _postSetAttributes()
return $this->_options;
}
+ public function getOptionsFiltered()
+ {
+ $res = $this->getOptions();
+ foreach ($this->_excludedOptions as $excludedOption) {
+ if (isset($res[$excludedOption])) {
+ unset($res[$excludedOption]);
+ }
+ }
+ return $res;
+ }
+
public function getColumnData()
{
$res = parent::getColumnData();