]> _ Git - cubist_cms-back.git/commitdiff
wip #56649 @0.25
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 14 Dec 2022 16:26:59 +0000 (17:26 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 14 Dec 2022 16:26:59 +0000 (17:26 +0100)
src/app/Magic/EntityData.php
src/app/Magic/Fields/Field.php

index 1e505018141112b8a410f60b8b175e0e75fabda4..bc8376d201ffd346700d77c7bb686e8625be417c 100644 (file)
@@ -73,10 +73,14 @@ class EntityData extends Data
     public function getImageFile($offset, $conversionName = '')
     {
         /** @var Media $media */
-        $media = $this->getMedia($offset)->get(0);
-        return $media->getPath($conversionName);
+        $media = $this->getMedia($offset);
+        if (!$media) {
+            return null;
+        }
+        return $media->get(0)->getPath($conversionName);
     }
 
+
     public function getMediaURL($offset, $default = null)
     {
         return $this->getImageURL($offset, '', $default);
index f578b7ae83c20c21025b6d663a412f912a6954b2..d6c7d6610a23b77ab3c20e735388860b9574c9d2 100644 (file)
@@ -155,7 +155,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' => [],
-            'placeholder' => $this->_placeholder, 'pattern' => $this->_pattern,
+            'placeholder' => $this->_placeholder, 'pattern' => $this->_pattern, 'class' => null,
         ];
     }
 
@@ -203,7 +203,7 @@ class Field implements \ArrayAccess
 
     protected function _getFieldAttributesKeys()
     {
-        return ['placeholder', 'rows', 'pattern'];
+        return ['placeholder', 'rows', 'pattern', 'class'];
     }
 
     protected function getFieldAttributes()