From 43d8a1c0d69af8e8608b43589d7861beb4392f60 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Mon, 11 Jan 2021 10:15:21 +0100 Subject: [PATCH] Add partner Add new record type partner. This can be something like a media partner or something else. Allow an event to have zero or more partner. Add necessary files and models with relations. Relates: #8092 --- Classes/Domain/Model/Event.php | 13 ++ Classes/Domain/Model/Partner.php | 59 ++++++++ .../TCA/tx_events_domain_model_event.php | 19 ++- .../TCA/tx_events_domain_model_partner.php | 133 ++++++++++++++++++ .../Language/de.locallang_csh_event.xlf | 4 + .../Language/de.locallang_csh_partner.xlf | 24 ++++ .../Private/Language/locallang_csh_event.xlf | 3 + .../Language/locallang_csh_partner.xlf | 20 +++ .../Icons/tx_events_domain_model_partner.gif | Bin 0 -> 230 bytes ext_tables.sql | 13 ++ 10 files changed, 287 insertions(+), 1 deletion(-) create mode 100644 Classes/Domain/Model/Partner.php create mode 100644 Configuration/TCA/tx_events_domain_model_partner.php create mode 100644 Resources/Private/Language/de.locallang_csh_partner.xlf create mode 100644 Resources/Private/Language/locallang_csh_partner.xlf create mode 100644 Resources/Public/Icons/tx_events_domain_model_partner.gif diff --git a/Classes/Domain/Model/Event.php b/Classes/Domain/Model/Event.php index d3ee979..db2996b 100644 --- a/Classes/Domain/Model/Event.php +++ b/Classes/Domain/Model/Event.php @@ -206,6 +206,11 @@ class Event extends AbstractEntity */ protected $categories; + /** + * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage + */ + protected $partner; + /** * @var int */ @@ -638,6 +643,14 @@ class Event extends AbstractEntity return $this->organizer; } + /** + * @return ObjectStorage + */ + public function getPartner(): ObjectStorage + { + return $this->partner; + } + /** * @param \Wrm\Events\Domain\Model\Organizer $organizer * @return void diff --git a/Classes/Domain/Model/Partner.php b/Classes/Domain/Model/Partner.php new file mode 100644 index 0000000..2b9a607 --- /dev/null +++ b/Classes/Domain/Model/Partner.php @@ -0,0 +1,59 @@ + + * + * 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. + */ + +use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; +use TYPO3\CMS\Extbase\Domain\Model\FileReference; +use TYPO3\CMS\Extbase\Persistence\ObjectStorage; + +class Partner extends AbstractEntity +{ + /** + * @var string + */ + protected $title = ''; + + /** + * @var string + */ + protected $link = ''; + + /** + * @var ObjectStorage + */ + protected $images = null; + + public function getTitle(): string + { + return $this->title; + } + + public function getLink(): string + { + return $this->link; + } + + public function getImages(): ObjectStorage + { + return $this->images; + } +} diff --git a/Configuration/TCA/tx_events_domain_model_event.php b/Configuration/TCA/tx_events_domain_model_event.php index 32ac676..b6eba8a 100644 --- a/Configuration/TCA/tx_events_domain_model_event.php +++ b/Configuration/TCA/tx_events_domain_model_event.php @@ -20,7 +20,7 @@ return [ 'iconfile' => 'EXT:events/Resources/Public/Icons/tx_events_domain_model_event.gif' ], 'types' => [ - '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title, global_id, slug, highlight, teaser, details, price_info, name, street, district, city, zip, country, phone, web, ticket, facebook, youtube, instagram, latitude, longitude, images, pages, categories, dates, organizer, region, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'], + '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title, global_id, slug, highlight, teaser, details, price_info, name, street, district, city, zip, country, phone, web, ticket, facebook, youtube, instagram, latitude, longitude, images, pages, categories, dates, organizer, region, partner, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'], ], 'columns' => [ 'sys_language_uid' => [ @@ -453,5 +453,22 @@ return [ 'maxitems' => 1, ], ], + + 'partner' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.partner', + 'config' => [ + 'type' => 'group', + 'internal_type' => 'db', + 'allowed' => 'tx_events_domain_model_partner', + 'fieldControl' => [ + 'addRecord' => [ + 'disabled' => false, + 'pid' => '###CURRENT_PID###', + 'table' => 'tx_events_domain_model_partner', + ], + ], + ], + ], ], ]; diff --git a/Configuration/TCA/tx_events_domain_model_partner.php b/Configuration/TCA/tx_events_domain_model_partner.php new file mode 100644 index 0000000..88320c3 --- /dev/null +++ b/Configuration/TCA/tx_events_domain_model_partner.php @@ -0,0 +1,133 @@ + [ + 'title' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_partner.xlf:tx_events_domain_model_partner', + 'label' => 'title', + 'thumbnail' => 'images', + 'tstamp' => 'tstamp', + 'crdate' => 'crdate', + 'cruser_id' => 'cruser_id', + 'versioningWS' => true, + 'languageField' => 'sys_language_uid', + 'transOrigPointerField' => 'l10n_parent', + 'transOrigDiffSourceField' => 'l10n_diffsource', + 'delete' => 'deleted', + 'enablecolumns' => [ + 'disabled' => 'hidden', + ], + 'searchFields' => 'title', + 'iconfile' => 'EXT:events/Resources/Public/Icons/tx_events_domain_model_partner.gif' + ], + 'types' => [ + '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title, link, images, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access'], + ], + 'columns' => [ + 'sys_language_uid' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.language', + 'config' => [ + 'type' => 'select', + 'renderType' => 'selectSingle', + 'special' => 'languages', + 'items' => [ + [ + 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.allLanguages', + -1, + 'flags-multiple' + ] + ], + 'default' => 0, + ], + ], + 'l10n_parent' => [ + 'displayCond' => 'FIELD:sys_language_uid:>:0', + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.l18n_parent', + 'config' => [ + 'type' => 'select', + 'renderType' => 'selectSingle', + 'default' => 0, + 'items' => [ + ['', 0], + ], + 'foreign_table' => 'tx_events_domain_model_partner', + 'foreign_table_where' => 'AND {#tx_events_domain_model_partner}.{#pid}=###CURRENT_PID### AND {#tx_events_domain_model_partner}.{#sys_language_uid} IN (-1,0)', + ], + ], + 'l10n_diffsource' => [ + 'config' => [ + 'type' => 'passthrough', + ], + ], + 't3ver_label' => [ + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.versionLabel', + 'config' => [ + 'type' => 'input', + 'size' => 30, + 'max' => 255, + ], + ], + 'hidden' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.visible', + 'config' => [ + 'type' => 'check', + 'renderType' => 'checkboxToggle', + 'items' => [ + [ + 0 => '', + 1 => '', + 'invertStateDisplay' => true + ] + ], + ], + ], + + 'title' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_partner.xlf:tx_events_domain_model_partner.title', + 'config' => [ + 'type' => 'input', + 'size' => 30, + 'eval' => 'trim' + ] + ], + 'link' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_partner.xlf:tx_events_domain_model_partner.link', + 'config' => [ + 'type' => 'input', + 'renderType' => 'inputLink', + 'eval' => 'trim', + 'max' => 1024, + 'size' => 50, + 'softref' => 'typolink', + ], + ], + 'images' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_partner.xlf:tx_events_domain_model_partner.images', + 'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig('images', [ + 'appearance' => [ + 'createNewRelationLinkTitle' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:images.addFileReference' + ], + // custom configuration for displaying fields in the overlay/reference table + // to use the imageoverlayPalette instead of the basicoverlayPalette + 'overrideChildTca' => [ + 'types' => [ + '0' => [ + 'showitem' => ' + --palette--;;imageoverlayPalette, + --palette--;;filePalette' + ], + \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [ + 'showitem' => ' + --palette--;;imageoverlayPalette, + --palette--;;filePalette' + ], + ], + ], + ], $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']) + ], + ], +]; diff --git a/Resources/Private/Language/de.locallang_csh_event.xlf b/Resources/Private/Language/de.locallang_csh_event.xlf index 5f157c9..d221efd 100644 --- a/Resources/Private/Language/de.locallang_csh_event.xlf +++ b/Resources/Private/Language/de.locallang_csh_event.xlf @@ -127,6 +127,10 @@ Organizer Organisator + + Partner + Partner + diff --git a/Resources/Private/Language/de.locallang_csh_partner.xlf b/Resources/Private/Language/de.locallang_csh_partner.xlf new file mode 100644 index 0000000..4f026b9 --- /dev/null +++ b/Resources/Private/Language/de.locallang_csh_partner.xlf @@ -0,0 +1,24 @@ + + + +
+ + + Partner + Partner + + + Title + Titel + + + Link + Link + + + Images + Bilder + + + + diff --git a/Resources/Private/Language/locallang_csh_event.xlf b/Resources/Private/Language/locallang_csh_event.xlf index 7f781ba..256f3c7 100644 --- a/Resources/Private/Language/locallang_csh_event.xlf +++ b/Resources/Private/Language/locallang_csh_event.xlf @@ -93,6 +93,9 @@ Region + + Partner + diff --git a/Resources/Private/Language/locallang_csh_partner.xlf b/Resources/Private/Language/locallang_csh_partner.xlf new file mode 100644 index 0000000..cbfc87b --- /dev/null +++ b/Resources/Private/Language/locallang_csh_partner.xlf @@ -0,0 +1,20 @@ + + + +
+ + + Partner + + + Title + + + Link + + + Images + + + + diff --git a/Resources/Public/Icons/tx_events_domain_model_partner.gif b/Resources/Public/Icons/tx_events_domain_model_partner.gif new file mode 100644 index 0000000000000000000000000000000000000000..37ba37b9b3a220018e3a291bf2ee413d0da30ce0 GIT binary patch literal 230 zcmZ?wbh9u|6krfwIKlt|GBPr{y1EAX`lY3%Jv}|Mz+f2|Yy*R1U~nA_UV_1QFaYW; z2AhC~Q2fcl$iN`NpaW6^vXg-|S;5tE3G-Y5<#kHRdp8`B$dNv*cXpRhl~&t>ccvU1 zeHPQ2GIn^1cr6p&73IaoD$=91iK~a{(6rVH&ROOxH+%Y4hNqsq`BO~MkEuZ}q3Mby Zn_ZKDm69U|7Z(ptCx?^igb9ia)&LfwP0|1W literal 0 HcmV?d00001 diff --git a/ext_tables.sql b/ext_tables.sql index 29ed630..ade216c 100644 --- a/ext_tables.sql +++ b/ext_tables.sql @@ -29,6 +29,7 @@ CREATE TABLE tx_events_domain_model_event ( pages text, dates int(11) unsigned DEFAULT '0' NOT NULL, organizer int(11) unsigned DEFAULT '0', + partner text, region int(11) unsigned DEFAULT '0', KEY dataHandler (l10n_parent, t3ver_oid, deleted, t3ver_wsid, t3ver_state) ); @@ -50,6 +51,18 @@ CREATE TABLE tx_events_domain_model_organizer ( KEY dataHandler (l10n_parent, sys_language_uid, deleted) ); +# +# Table structure for table 'tx_events_domain_model_partner' +# +CREATE TABLE tx_events_domain_model_partner ( + + title varchar(255) DEFAULT '' NOT NULL, + link varchar(255) DEFAULT '' NOT NULL, + images int(11) unsigned NOT NULL default '0', + + KEY dataHandler (l10n_parent, sys_language_uid, deleted) +); + # # Table structure for table 'tx_events_domain_model_date' #