diff --git a/Classes/Domain/Model/Import.php b/Classes/Domain/Model/Import.php
index 400b0341..1ae05b2e 100644
--- a/Classes/Domain/Model/Import.php
+++ b/Classes/Domain/Model/Import.php
@@ -6,6 +6,7 @@
use TYPO3\CMS\Core\Resource\Folder;
use TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject;
+use WerkraumMedia\Events\Domain\Model\Import\Features;
/**
* Actual request to import.
@@ -26,7 +27,8 @@ public function __construct(
protected ?Category $categoryParent = null,
int $featuresPid = 0,
protected ?Category $featuresParent = null,
- protected ?Region $region = null
+ protected ?Region $region = null,
+ protected int $importFeatures = 0,
) {
// Do not allow categories on pid 0
if ($categoriesPid === 0) {
@@ -85,4 +87,9 @@ public function getSearchQuery(): string
{
return $this->restSearchQuery;
}
+
+ public function getFeatures(): Features
+ {
+ return new Features($this->importFeatures);
+ }
}
diff --git a/Classes/Domain/Model/Import/Features.php b/Classes/Domain/Model/Import/Features.php
new file mode 100644
index 00000000..bf7a8c0d
--- /dev/null
+++ b/Classes/Domain/Model/Import/Features.php
@@ -0,0 +1,36 @@
+
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+namespace WerkraumMedia\Events\Domain\Model\Import;
+
+use TYPO3\CMS\Core\Type\BitSet;
+
+final class Features extends BitSet
+{
+ public const HTML_FOR_DETAIL = 0b1;
+
+ public function hasHtmlForDetailEnabled(): bool
+ {
+ return $this->get(self::HTML_FOR_DETAIL);
+ }
+}
diff --git a/Classes/Service/DestinationDataImportService.php b/Classes/Service/DestinationDataImportService.php
index af04c2c1..36df56c7 100644
--- a/Classes/Service/DestinationDataImportService.php
+++ b/Classes/Service/DestinationDataImportService.php
@@ -356,25 +356,58 @@ private function hasRelation(string $needle, array $haystack): bool
private function setTexts(array $texts): void
{
$shouldSetPrice = true;
+ $detailText = '';
+
foreach ($texts as $text) {
- if (isset($text['value']) === false) {
+ if (
+ isset($text['value']) === false
+ || is_string($text['value']) === false
+ ) {
continue;
}
- if ($text['rel'] == 'details' && $text['type'] == 'text/plain') {
- $this->tmpCurrentEvent->setDetails(str_replace("\n\n", "\n", (string)$text['value']));
+ $value = str_replace("\n\n", "\n", $text['value']);
+
+ if (
+ $text['rel'] == 'details'
+ && $text['type'] == 'text/html'
+ && $this->import->getFeatures()->hasHtmlForDetailEnabled()
+ && $value
+ ) {
+ $detailText = $value;
+ continue;
}
+
+ if (
+ $text['rel'] == 'details'
+ && $text['type'] == 'text/plain'
+ && (
+ $this->import->getFeatures()->hasHtmlForDetailEnabled() === false
+ || $detailText === ''
+ )
+ ) {
+ $detailText = $value;
+ continue;
+ }
+
if ($text['rel'] == 'teaser' && $text['type'] == 'text/plain') {
- $this->tmpCurrentEvent->setTeaser(str_replace("\n\n", "\n", (string)$text['value']));
+ $this->tmpCurrentEvent->setTeaser($value);
+ continue;
}
+
if ($shouldSetPrice && $text['rel'] == 'PRICE_INFO_EXTRA' && $text['type'] == 'text/plain') {
$shouldSetPrice = false;
- $this->tmpCurrentEvent->setPriceInfo(str_replace("\n\n", "\n", (string)$text['value']));
+ $this->tmpCurrentEvent->setPriceInfo($value);
+ continue;
}
+
if ($shouldSetPrice && $text['rel'] == 'PRICE_INFO' && $text['type'] == 'text/plain') {
- $this->tmpCurrentEvent->setPriceInfo(str_replace("\n\n", "\n", (string)$text['value']));
+ $this->tmpCurrentEvent->setPriceInfo($value);
+ continue;
}
}
+
+ $this->tmpCurrentEvent->setDetails($detailText);
}
private function getOrCreateEvent(string $globalId, string $title): Event
diff --git a/Configuration/TCA/tx_events_domain_model_import.php b/Configuration/TCA/tx_events_domain_model_import.php
index cda62bbd..e7f93cce 100644
--- a/Configuration/TCA/tx_events_domain_model_import.php
+++ b/Configuration/TCA/tx_events_domain_model_import.php
@@ -19,7 +19,20 @@
],
'types' => [
'1' => [
- 'showitem' => 'title, hidden, --div--;LLL:EXT:events/Resources/Private/Language/locallang_csh_import.xlf:tx_events_domain_model_import.div.typo3, --palette--;;typo3_storage, --palette--;;categories, --palette--;;features,--palette--;;relations, --div--;LLL:EXT:events/Resources/Private/Language/locallang_csh_import.xlf:tx_events_domain_model_import.div.rest, rest_experience, rest_search_query',
+ 'showitem' => implode(',', [
+ 'title',
+ 'hidden',
+ '--div--;LLL:EXT:events/Resources/Private/Language/locallang_csh_import.xlf:tx_events_domain_model_import.div.typo3',
+ '--palette--;;typo3_storage',
+ '--palette--;;categories',
+ '--palette--;;features',
+ '-palette--;;relations',
+ '--div--;LLL:EXT:events/Resources/Private/Language/locallang_csh_import.xlf:tx_events_domain_model_import.div.rest',
+ 'rest_experience',
+ 'rest_search_query',
+ '--div--;LLL:EXT:events/Resources/Private/Language/locallang_csh_import.xlf:tx_events_domain_model_import.div.import',
+ 'import_features',
+ ]),
],
],
'palettes' => [
@@ -169,5 +182,20 @@
'max' => 255,
],
],
+ 'import_features' => [
+ 'exclude' => true,
+ 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_import.xlf:tx_events_domain_model_import.import_features',
+ 'description' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_import.xlf:tx_events_domain_model_import.import_features.description',
+ 'config' => [
+ 'type' => 'check',
+ 'cols' => 'inline',
+ 'default' => '0',
+ 'items' => [
+ [
+ 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_import.xlf:tx_events_domain_model_import.import_features.html_for_detail',
+ ],
+ ],
+ ],
+ ],
],
];
diff --git a/Documentation/Changelog/4.2.0.rst b/Documentation/Changelog/4.2.0.rst
new file mode 100644
index 00000000..d23aec14
--- /dev/null
+++ b/Documentation/Changelog/4.2.0.rst
@@ -0,0 +1,33 @@
+4.2.0
+=====
+
+Breaking
+--------
+
+Nothing
+
+Features
+--------
+
+* Support HTML for detail text of events when importing data from destination.one.
+
+ This can be enabled within the import configuration. That way one can restrict the
+ HTML import to certain import configurations.
+
+ Ensure to adjust the templates when turning on the feature.
+ Either use `f:format.html` or `f:sanitize.html` as content might be unsafe.
+
+Fixes
+-----
+
+Nothing
+
+Tasks
+-----
+
+Nothing
+
+Deprecation
+-----------
+
+Nothing
diff --git a/Resources/Private/Language/locallang_csh_import.xlf b/Resources/Private/Language/locallang_csh_import.xlf
index 8d81c0c9..ca9ba97a 100644
--- a/Resources/Private/Language/locallang_csh_import.xlf
+++ b/Resources/Private/Language/locallang_csh_import.xlf
@@ -12,6 +12,9 @@
+
+
+
@@ -81,6 +84,15 @@
+
+
+
+
+
+
+
+
+