-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #137 from TYPO3incubator/task/people_overview_ce
[TASK] Add basic content element for persons overview
- Loading branch information
Showing
7 changed files
with
184 additions
and
1 deletion.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
...figuration/Sets/Football/TypoScript/ContentElements/tt_content.personsoverview.typoscript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
tt_content { | ||
persons_overview =< lib.contentElement | ||
persons_overview { | ||
templateName = PersonsOverview | ||
|
||
dataProcessing { | ||
10 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor | ||
10 { | ||
if.isTrue.field = persons | ||
table = tx_football_domain_model_person | ||
pidInList.field = pid | ||
where = {#parentid}=###uid### | ||
markers.uid.field = uid | ||
selectFields = name,image | ||
orderBy = sorting | ||
as = persons | ||
dataProcessing { | ||
10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor | ||
10 { | ||
references.fieldName = image | ||
as = image | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
69 changes: 69 additions & 0 deletions
69
local_packages/football/Configuration/TCA/Overrides/tt_content.personsoverview.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; | ||
|
||
call_user_func(static function() { | ||
|
||
$ext = 'football'; | ||
$cType = 'persons_overview'; | ||
$languageFile = 'LLL:EXT:' . $ext . '/Resources/Private/Language/locallang_db.tt_content.' . $cType . '.xlf'; | ||
|
||
ExtensionManagementUtility::addTcaSelectItem( | ||
'tt_content', | ||
'CType', | ||
[ | ||
'label' => $languageFile . ':title', | ||
'value' => $cType, | ||
'group' => 'special', | ||
'icon' => 'actions-users', | ||
'description' => $languageFile . ':description', | ||
] | ||
); | ||
|
||
$temporaryColumns = [ | ||
'persons' => [ | ||
'label' => $languageFile . ':persons', | ||
'config' => [ | ||
'type' => 'inline', | ||
'foreign_table' => 'tx_football_domain_model_person', | ||
'foreign_table_field' => 'parenttable', | ||
'foreign_field' => 'parentid', | ||
'minitems' => 1, | ||
'appearance' => [ | ||
'useSortable' => true | ||
], | ||
], | ||
], | ||
]; | ||
|
||
ExtensionManagementUtility::addTCAcolumns( | ||
'tt_content', | ||
$temporaryColumns | ||
); | ||
|
||
// add the icon to the typeicon_class | ||
$GLOBALS['TCA']['tt_content']['ctrl']['typeicon_classes'][$cType] = 'actions-users'; | ||
|
||
$GLOBALS['TCA']['tt_content']['types'][$cType] = [ | ||
'showitem' => ' | ||
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general, | ||
--palette--;;general, | ||
header;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:header_formlabel, | ||
persons, | ||
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:appearance, | ||
--palette--;;frames, | ||
--palette--;;appearanceLinks, | ||
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:language, | ||
--palette--;;language, | ||
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access, | ||
--palette--;;hidden, | ||
--palette--;;access, | ||
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:categories, | ||
categories, | ||
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:notes, | ||
rowDescription, | ||
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:extended, | ||
', | ||
]; | ||
}); |
46 changes: 46 additions & 0 deletions
46
local_packages/football/Configuration/TCA/tx_football_domain_model_person.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
$ext = 'football'; | ||
$table = 'tx_football_domain_model_person'; | ||
$dbLangFile = 'LLL:EXT:' . $ext . '/Resources/Private/Language/locallang_db.xlf'; | ||
|
||
return [ | ||
'ctrl' => [ | ||
'title' => $dbLangFile . ':' . $table, | ||
'label' => 'name', | ||
'tstamp' => 'tstamp', | ||
'crdate' => 'crdate', | ||
'sortby' => 'sorting', | ||
'searchFields' => 'name', | ||
'typeicon_classes' => [ | ||
'default' => 'actions-user', | ||
], | ||
'security' => [ | ||
'ignorePageTypeRestriction' => true, | ||
] | ||
], | ||
'types' => [ | ||
'1' => ['showitem' => 'name, image'], | ||
], | ||
'columns' => [ | ||
'name' => [ | ||
'exclude' => true, | ||
'label' => $dbLangFile . ':' . $table . '.name', | ||
'config' => [ | ||
'type' => 'text', | ||
'rows' => 1, | ||
'cols' => 30, | ||
'eval' => 'trim', | ||
] | ||
], | ||
'image' => [ | ||
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.images', | ||
'config' => [ | ||
'type' => 'file', | ||
'allowed' => 'common-image-types', | ||
'minitems' => 1, | ||
'maxitems' => 1, | ||
] | ||
], | ||
], | ||
]; |
2 changes: 1 addition & 1 deletion
2
local_packages/football/Configuration/TsConfig/TCEFORM/tt_content.tsconfig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...packages/football/Resources/Private/Language/locallang_db.tt_content.persons_overview.xlf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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="2024-06-10UTC11:34:290"> | ||
<header> | ||
<authorName>Surfcamp-Team4</authorName> | ||
<authorEmail>[email protected]</authorEmail> | ||
</header> | ||
<body> | ||
<trans-unit id="title"> | ||
<source>Persons Overview</source> | ||
</trans-unit> | ||
<trans-unit id="description"> | ||
<source>Overview of relevant persons in your club</source> | ||
</trans-unit> | ||
<trans-unit id="persons"> | ||
<source>Persons</source> | ||
</trans-unit> | ||
</body> | ||
</file> | ||
</xliff> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
local_packages/football/Resources/Private/Templates/ContentElements/PersonsOverview.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<html data-namespace-typo3-fluid="true" xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"> | ||
|
||
{data.header} | ||
<f:for each="{persons}" as="person"> | ||
<p>{person.data.name}</p> | ||
<f:image image="{person.image.0}" alt="{person.data.name}" width="200" height="auto" treatIdAsReference="1" /> | ||
</f:for> | ||
|
||
</html> |