From 845c254b28eaa28b07868dc666933db29ab590af Mon Sep 17 00:00:00 2001 From: vince Date: Sun, 14 Nov 2021 13:33:13 +0100 Subject: [PATCH] . --- src/app/Magic/Fields/Field.php | 9 +++++++-- src/app/Magic/Fields/Textarea.php | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/app/Magic/Fields/Field.php b/src/app/Magic/Fields/Field.php index d5036af..a098b1b 100644 --- a/src/app/Magic/Fields/Field.php +++ b/src/app/Magic/Fields/Field.php @@ -151,7 +151,7 @@ class Field implements \ArrayAccess 'can' => $this->_can, 'can_write' => $this->_canWrite, 'auth' => $this->_auth, 'database_type' => $this->_databaseType, 'database_unique' => $this->_databaseUnique, 'database_index' => $this->_databaseIndex, 'database_default' => $this->_databaseDefault, 'database_length' => $this->_databaseLength, 'fake' => false, 'store_in' => 'extras', 'attributes' => [], - 'field_attributes.placeholder' => $this->_placeholder, + 'placeholder' => $this->_placeholder, ]; } @@ -194,11 +194,16 @@ class Field implements \ArrayAccess protected function getFieldAttributes() { $res = []; + + $fieldAttributes = ['placeholder', 'rows']; + foreach ($this->_attributes as $k => $v) { if (null === $v) { continue; } - if (strstr($k, 'field_attributes.')) { + if (in_array($k, $fieldAttributes)) { + Arr::set($res, $k, $v); + } else if (strstr($k, 'field_attributes.')) { $e = explode('.', $k, 2); Arr::set($res, $e[1], $v); } diff --git a/src/app/Magic/Fields/Textarea.php b/src/app/Magic/Fields/Textarea.php index 9fdcc4c..a38520d 100644 --- a/src/app/Magic/Fields/Textarea.php +++ b/src/app/Magic/Fields/Textarea.php @@ -13,10 +13,10 @@ class Textarea extends Field protected $_translatable = true; protected $_columnType = 'textarea'; protected $_columnViewNamespace = CubistBackpackServiceProvider::NAMESPACE . '::columns'; - protected $_fieldHeight = 7; + protected $_rows = 7; public function getDefaultAttributes() { - return array_merge(parent::getDefaultAttributes(), ['field_attributes.rows' => $this->_fieldHeight]); + return array_merge(parent::getDefaultAttributes(), ['rows' => $this->_rows]); } } -- 2.39.5