From: Vincent Vanwaelscappel Date: Mon, 17 Jun 2019 15:21:19 +0000 (+0200) Subject: wip #2837 @2 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=986717f791b32ce87ad180a3c892182fec4a8a36;p=cubist_cms-back.git wip #2837 @2 --- diff --git a/src/app/Magic/Fields/Field.php b/src/app/Magic/Fields/Field.php index 7accbd2..aa88d1c 100644 --- a/src/app/Magic/Fields/Field.php +++ b/src/app/Magic/Fields/Field.php @@ -119,9 +119,15 @@ class Field public function getDefinition() { + $this->_preGetDefinition(); return $this->_attributes; } + protected function _preGetDefinition() + { + + } + public function init() { diff --git a/src/app/Magic/Fields/SelectFromModel.php b/src/app/Magic/Fields/SelectFromModel.php index eae4a0c..e5a77f4 100644 --- a/src/app/Magic/Fields/SelectFromModel.php +++ b/src/app/Magic/Fields/SelectFromModel.php @@ -9,8 +9,10 @@ use Cubist\Backpack\CubistBackpackServiceProvider; class SelectFromModel extends Model { protected $_adminType = 'select2_from_array'; + protected $_columnViewNamespace = CubistBackpackServiceProvider::NAMESPACE . '::columns'; protected $_columnType = 'select_from_array'; + protected $_databaseType = 'string'; protected $_multiple = false; protected $_order = false; @@ -20,10 +22,14 @@ class SelectFromModel extends Model return array_merge(parent::getDefaultAttributes(), ['order' => $this->_order]); } - public function _postSetAttributes() + protected function _preGetDefinition() { + parent::_preGetDefinition(); $this->setAttribute('options', $this->_getOptions()); + } + public function _postSetAttributes() + { if ($this->getAttribute('allows_multiple') && $this->getAttribute('order')) { $this->setAttribute('type', 'select_and_order'); }