Skip to content

Commit

Permalink
Merge pull request #137 from TYPO3incubator/task/people_overview_ce
Browse files Browse the repository at this point in the history
[TASK] Add basic content element for persons overview
  • Loading branch information
lkreitz authored Jun 12, 2024
2 parents d65bfa5 + e85c649 commit 51b0e03
Show file tree
Hide file tree
Showing 7 changed files with 184 additions and 1 deletion.
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
}
}
}
}
}
}
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,
',
];
});
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,
]
],
],
];
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
TCEFORM.tt_content {
CType.keepItems = game_results,textmedia,cta,hero,sponsors,form_formframework,event_teaser,news_teaser,indexedsearch_pi2
CType.keepItems = game_results,textmedia,cta,hero,sponsors,form_formframework,event_teaser,news_teaser,indexedsearch_pi2,persons_overview

header_layout {
keepItems = 2,3,4,100
Expand Down
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>
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,18 @@
<source>Image</source>
</trans-unit>
<!-- END: tx_football_domain_model_sponsor -->

<!-- BEGIN: tx_football_domain_model_person -->
<trans-unit id="tx_football_domain_model_person">
<source>Person</source>
</trans-unit>
<trans-unit id="tx_football_domain_model_person.name">
<source>Name</source>
</trans-unit>
<trans-unit id="tx_football_domain_model_person.image">
<source>Image</source>
</trans-unit>
<!-- END: tx_football_domain_model_person -->
</body>
</file>
</xliff>
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>

0 comments on commit 51b0e03

Please sign in to comment.