diff --git a/Classes/Domain/Model/.gitkeep b/Classes/Domain/Model/.gitkeep
deleted file mode 100644
index e69de29..0000000
diff --git a/Classes/Domain/Model/Product/Tea.php b/Classes/Domain/Model/Product/Tea.php
index 754abf7..322fac2 100644
--- a/Classes/Domain/Model/Product/Tea.php
+++ b/Classes/Domain/Model/Product/Tea.php
@@ -2,7 +2,9 @@
declare(strict_types = 1);
namespace OliverKlee\Tea\Domain\Model\Product;
+use TYPO3\CMS\Extbase\Domain\Model\FileReference;
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
+use TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy;
/**
* This class represents a tea (flavor), e.g., "Earl Grey".
@@ -21,6 +23,12 @@ class Tea extends AbstractEntity
*/
protected $description = '';
+ /**
+ * @var \TYPO3\CMS\Extbase\Domain\Model\FileReference
+ * @lazy
+ */
+ protected $image = null;
+
/**
* @return string
*/
@@ -56,4 +64,26 @@ class Tea extends AbstractEntity
{
$this->description = $description;
}
+
+ /**
+ * @return FileReference|null
+ */
+ public function getImage()
+ {
+ if ($this->image instanceof LazyLoadingProxy) {
+ $this->image = $this->image->_loadRealInstance();
+ }
+
+ return $this->image;
+ }
+
+ /**
+ * @param FileReference $image
+ *
+ * @return void
+ */
+ public function setImage(FileReference $image)
+ {
+ $this->image = $image;
+ }
}
diff --git a/Configuration/TCA/tx_tea_domain_model_product_tea.php b/Configuration/TCA/tx_tea_domain_model_product_tea.php
index 4abf6e5..7514525 100644
--- a/Configuration/TCA/tx_tea_domain_model_product_tea.php
+++ b/Configuration/TCA/tx_tea_domain_model_product_tea.php
@@ -13,10 +13,10 @@ return [
'searchFields' => 'title, description',
],
'interface' => [
- 'showRecordFieldList' => 'title, description',
+ 'showRecordFieldList' => 'title, description, image',
],
'types' => [
- '1' => ['showitem' => 'title, description'],
+ '1' => ['showitem' => 'title, description, image'],
],
'columns' => [
'title' => [
@@ -38,5 +38,21 @@ return [
'eval' => 'trim',
],
],
+ 'image' => [
+ 'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_product_tea.image',
+ 'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
+ 'image',
+ [
+ 'maxitems' => 1,
+ 'appearance' => [
+ 'collapseAll' => true,
+ 'useSortable' => false,
+ 'enabledControls' => [
+ 'hide' => false,
+ ],
+ ],
+ ]
+ ),
+ ],
],
];
diff --git a/Resources/Private/Language/de.locallang_db.xlf b/Resources/Private/Language/de.locallang_db.xlf
index 77c6869..ca14dd7 100644
--- a/Resources/Private/Language/de.locallang_db.xlf
+++ b/Resources/Private/Language/de.locallang_db.xlf
@@ -15,6 +15,10 @@
Beschreibung
+
+
+ Bild
+