From: Vincent Vanwaelscappel Date: Mon, 26 Jul 2021 14:51:01 +0000 (+0200) Subject: wip #4612 @0.25 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=54c8540cac400905c3cbc585be5710c0080debd0;p=cubist_cms-back.git wip #4612 @0.25 --- diff --git a/src/app/Magic/BunchOfFields.php b/src/app/Magic/BunchOfFields.php index 92c181d..617a015 100644 --- a/src/app/Magic/BunchOfFields.php +++ b/src/app/Magic/BunchOfFields.php @@ -69,6 +69,15 @@ trait BunchOfFields */ public function getField($name) { - return isset($this->_fields[$name]) ? $this->_fields[$name] : null; + return $this->_fields[$name] ?? null; + } + + /** + * @param $name string + * @return bool + */ + public function hasField($name): bool + { + return isset($this->_fields[$name]); } } diff --git a/src/app/Magic/Fields/Field.php b/src/app/Magic/Fields/Field.php index bd9983e..42caacd 100644 --- a/src/app/Magic/Fields/Field.php +++ b/src/app/Magic/Fields/Field.php @@ -23,6 +23,7 @@ class Field implements \ArrayAccess protected $_columnType = 'text'; protected $_columnMoveAfter = false; protected $_columnFormat = null; + protected $_preview = true; protected $_filterType = 'simple'; @@ -132,7 +133,8 @@ class Field implements \ArrayAccess 'fillable' => true, 'guarded' => false, 'hidden' => false, 'filter' => false, 'filter_type' => $this->_filterType, 'filter_label' => null, 'filter_values' => $this->_filterValues, 'translatable' => $this->_translatable, 'migrateTranslatable' => $this->_migrateTranslatable, - 'preview' => $this->_preview, 'column_type' => $this->_columnType, 'column_move_after' => $this->_columnMoveAfter, 'column_format' => $this->_columnFormat, + 'preview' => $this->_preview, + 'column_type' => $this->_columnType, 'column_move_after' => $this->_columnMoveAfter, 'column_format' => $this->_columnFormat, 'column_width' => 300, 'default' => '', 'cast' => $this->_cast, 'column_view_namespace' => $this->_columnViewNamespace, 'searchLogic' => $this->_searchLogic, 'allow_null' => true, 'can' => $this->_can, 'can_write' => $this->_canWrite, 'auth' => $this->_auth, @@ -203,6 +205,14 @@ class Field implements \ArrayAccess 'orderable' => true, ]; + if ($this->hasAttribute('column_function_name')) { + $res['function_name'] = $this->getAttribute('column_function_name'); + } + + if ($this->hasAttribute('column_limit')) { + $res['limit'] = $this->getAttribute('column_limit'); + } + return $res; } @@ -357,7 +367,8 @@ class Field implements \ArrayAccess return $value; } - public function filterDefault($value){ + public function filterDefault($value) + { return $value; }