]> _ Git - cubist_cms-back.git/commitdiff
.
authorvince <vincent@enhydra.fr>
Sun, 14 Nov 2021 12:33:13 +0000 (13:33 +0100)
committervince <vincent@enhydra.fr>
Sun, 14 Nov 2021 12:33:13 +0000 (13:33 +0100)
src/app/Magic/Fields/Field.php
src/app/Magic/Fields/Textarea.php

index d5036afd0b4b911cec8436912278ab292bc17fd1..a098b1bbd601be85c044e72661dd5ccce4f4bce6 100644 (file)
@@ -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);
             }
index 9fdcc4cf633daf0c075f9290ad8890c0258a9442..a38520dfa0f9578a443b31e03401134c20c378a2 100644 (file)
@@ -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]);
     }
 }