Skip to content

Commit

Permalink
[TASK] Add plugin for selected projects
Browse files Browse the repository at this point in the history
  • Loading branch information
torben-fr committed Aug 21, 2024
1 parent f2e9cf0 commit 3d71ea3
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 9 deletions.
10 changes: 4 additions & 6 deletions Classes/Controller/ProjectController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,10 @@ public function listAction(?ProjectFilter $filter = null): ResponseInterface

$projects = $this->projectRepository->findByFilter(
$filter,
GeneralUtility::intExplode(
',',
$this->configurationManager->getContentObject()
? $this->configurationManager->getContentObject()->data['pages']
: []
)
$this->configurationManager->getContentObject()->data['pages'] !== ''
? GeneralUtility::intExplode(',', $this->configurationManager->getContentObject()->data['pages'])
: [],
$this->configurationManager->getContentObject()->data['list_type'] === 'academicprojects_projectlistsingle' ? true : false
);

$categories =$this->categoryRepository->findAllApplicable($projects);
Expand Down
6 changes: 5 additions & 1 deletion Classes/Domain/Repository/ProjectRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ class ProjectRepository extends Repository
*/
public function findByFilter(
?ProjectFilter $filter = null,
array $pages = []
array $pages = [],
bool $selected = false
): QueryResult {
$query = $this->createQuery();

Expand All @@ -35,6 +36,9 @@ public function findByFilter(
}
}
}
if ($selected && !empty($pages)) {
$constraints[] = $query->in('uid', $pages);
}

$query->matching(
$query->logicalAnd($constraints)
Expand Down
12 changes: 12 additions & 0 deletions Configuration/TCA/Overrides/tt_content.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,24 @@
$ll('tx_academic_projects_p1.name'),
'actions-code-merge'
);
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
'AcademicProjects',
'ProjectListSingle',
$ll('tx_academic_projects_p2.name'),
'actions-code-merge'
);

$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['academicprojects_projectlist'] = 'layout,recursive';
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['academicprojects_projectlist'] = 'pi_flexform';
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['academicprojects_projectlistsingle'] = 'layout,recursive';
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['academicprojects_projectlistsingle'] = 'pi_flexform';

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue(
'academicprojects_projectlist',
'FILE:EXT:academic_projects/Configuration/FlexForms/ProjectSettings.xml'
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue(
'academicprojects_projectlistsingle',
'FILE:EXT:academic_projects/Configuration/FlexForms/ProjectSettings.xml'
);
})();
13 changes: 11 additions & 2 deletions Configuration/TsConfig/Page/Mod/Wizards/NewContentElement.tsconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,16 @@ mod.wizards {
list_type = academicprojects_projectlist
}
}
academicprojects_projectlistsingle {
iconIdentifier = actions-code-merge
title = LLL:EXT:academic_projects/Resources/Private/Language/locallang_db.xlf:tx_academic_projects_p2.name
description = LLL:EXT:academic_projects/Resources/Private/Language/locallang_db.xlf:tx_academic_projects_p2.description
tt_content_defValues {
CType = list
list_type = academicprojects_projectlistsingle
}
}
}
show := addToList(academicprojects_projectlist)
show := addToList(academicprojects_projectlist, academicprojects_projectlistsingle)
}
}
}
8 changes: 8 additions & 0 deletions Resources/Private/Language/de.locallang_db.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@
<source>List of academic projects with sorting and filtering</source>
<target>Liste akademischer Projekte mit Sortierung und Filterung</target>
</trans-unit>
<trans-unit id="tx_academic_projects_p2.name" resname="tx_academic_projects_p2.name">
<source>Academic Projects (selected)</source>
<target>Akademische Projekte (ausgewählte)</target>
</trans-unit>
<trans-unit id="tx_academic_projects_p2.description" resname="tx_academic_projects_p2.description">
<source>List of selected academic projects with sorting and filtering</source>
<target>Liste ausgewählter akademischer Projekte mit Sortierung und Filterung</target>
</trans-unit>
<trans-unit id="wizard_items.academic">
<source>Academic</source>
<target>Akademisch</target>
Expand Down
6 changes: 6 additions & 0 deletions Resources/Private/Language/locallang_db.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@
<trans-unit id="tx_academic_projects_p1.description" resname="tx_academic_projects_p1.description">
<source>List of academic projects with sorting and filtering</source>
</trans-unit>
<trans-unit id="tx_academic_projects_p2.name" resname="tx_academic_projects_p2.name">
<source>Academic Projects (selected)</source>
</trans-unit>
<trans-unit id="tx_academic_projects_p2.description" resname="tx_academic_projects_p2.description">
<source>List of selected academic projects with sorting and filtering</source>
</trans-unit>
<trans-unit id="wizard_items.academic">
<source>Academic</source>
</trans-unit>
Expand Down
10 changes: 10 additions & 0 deletions ext_localconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,14 @@
\FGTCLB\AcademicProjects\Controller\ProjectController::class => 'list',
]
);
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'AcademicProjects',
'ProjectListSingle',
[
\FGTCLB\AcademicProjects\Controller\ProjectController::class => 'list',
],
[
\FGTCLB\AcademicProjects\Controller\ProjectController::class => 'list',
]
);
})();

0 comments on commit 3d71ea3

Please sign in to comment.