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
This commit is contained in:
Daniel Siepmann 2021-01-11 10:15:21 +01:00
parent 38b4844a9d
commit 43d8a1c0d6
10 changed files with 287 additions and 1 deletions

View file

@ -206,6 +206,11 @@ class Event extends AbstractEntity
*/
protected $categories;
/**
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<Partner>
*/
protected $partner;
/**
* @var int
*/
@ -638,6 +643,14 @@ class Event extends AbstractEntity
return $this->organizer;
}
/**
* @return ObjectStorage<Partner>
*/
public function getPartner(): ObjectStorage
{
return $this->partner;
}
/**
* @param \Wrm\Events\Domain\Model\Organizer $organizer
* @return void

View file

@ -0,0 +1,59 @@
<?php
namespace Wrm\Events\Domain\Model;
/*
* Copyright (C) 2021 Daniel Siepmann <coding@daniel-siepmann.de>
*
* 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<FileReference>
*/
protected $images = null;
public function getTitle(): string
{
return $this->title;
}
public function getLink(): string
{
return $this->link;
}
public function getImages(): ObjectStorage
{
return $this->images;
}
}

View file

@ -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',
],
],
],
],
],
];

View file

@ -0,0 +1,133 @@
<?php
return [
'ctrl' => [
'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'])
],
],
];

View file

@ -127,6 +127,10 @@
<source>Organizer</source>
<target>Organisator</target>
</trans-unit>
<trans-unit id="tx_events_domain_model_event.partner">
<source>Partner</source>
<target>Partner</target>
</trans-unit>
</body>
</file>
</xliff>

View file

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<xliff version="1.0">
<file source-language="en" datatype="plaintext" original="messages" date="2019-04-03T12:11:11Z" product-name="tx_events">
<header/>
<body>
<trans-unit id="tx_events_domain_model_partner">
<source>Partner</source>
<target>Partner</target>
</trans-unit>
<trans-unit id="tx_events_domain_model_partner.title">
<source>Title</source>
<target>Titel</target>
</trans-unit>
<trans-unit id="tx_events_domain_model_partner.link">
<source>Link</source>
<target>Link</target>
</trans-unit>
<trans-unit id="tx_events_domain_model_partner.images">
<source>Images</source>
<target>Bilder</target>
</trans-unit>
</body>
</file>
</xliff>

View file

@ -93,6 +93,9 @@
<trans-unit id="tx_events_domain_model_event.region">
<source>Region</source>
</trans-unit>
<trans-unit id="tx_events_domain_model_event.partner">
<source>Partner</source>
</trans-unit>
</body>
</file>
</xliff>

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<xliff version="1.0">
<file source-language="en" datatype="plaintext" original="messages" date="2019-04-03T12:11:11Z" product-name="tx_events">
<header/>
<body>
<trans-unit id="tx_events_domain_model_partner">
<source>Partner</source>
</trans-unit>
<trans-unit id="tx_events_domain_model_partner.title">
<source>Title</source>
</trans-unit>
<trans-unit id="tx_events_domain_model_partner.link">
<source>Link</source>
</trans-unit>
<trans-unit id="tx_events_domain_model_partner.images">
<source>Images</source>
</trans-unit>
</body>
</file>
</xliff>

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 B

View file

@ -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'
#