diff --git a/Classes/ViewHelpers/SkillGroupingViewHelper.php b/Classes/ViewHelpers/SkillGroupingViewHelper.php
index 1701ace..e96da75 100644
--- a/Classes/ViewHelpers/SkillGroupingViewHelper.php
+++ b/Classes/ViewHelpers/SkillGroupingViewHelper.php
@@ -36,7 +36,7 @@ use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
*
* {skill.name}
*
- *
+ *
*/
class SkillGroupingViewHelper extends AbstractViewHelper
{
@@ -52,10 +52,11 @@ class SkillGroupingViewHelper extends AbstractViewHelper
}
public static function renderStatic(
- array $arguments,
- Closure $renderChildrenClosure,
+ array $arguments,
+ Closure $renderChildrenClosure,
RenderingContextInterface $renderingContext
- ) {
+ )
+ {
/** @var Skill[] $skills */
$skills = $arguments['skills'];
/** @var SkillSet $skillSet */
@@ -84,16 +85,24 @@ class SkillGroupingViewHelper extends AbstractViewHelper
*/
protected static function group(array $skills): array
{
- $result = [
- /*
- * [
- * 'title' => 'Domain 1',
- * 'skills' => [...skills]
- * ]
- */
- ];
+ $domainTags = [];
+ foreach ($skills as $skill) {
+ $domainTags[] = isset($skill->toArray()['domainTag']) ? $skill->toArray()['domainTag']['title'] : "none";
+ }
+ $domainTags = array_unique($domainTags);
- // todo group skills based on domainTag|title
+ $result = [];
+ foreach ($domainTags as $domainTag) {
+ $result[] = [
+ 'title' => $domainTag,
+ 'skills' => array_filter($skills, function (Skill $skill) use ($domainTag) {
+ if (!isset($skill->toArray()['domainTag'])) {
+ return $domainTag === "none";
+ }
+ return $skill->toArray()['domainTag']['title'] === $domainTag;
+ })
+ ];
+ }
return $result;
}
}
diff --git a/Resources/Private/Templates/ContentElements/SkillDisplaySkillSet.html b/Resources/Private/Templates/ContentElements/SkillDisplaySkillSet.html
index bb1e3c0..28d1736 100644
--- a/Resources/Private/Templates/ContentElements/SkillDisplaySkillSet.html
+++ b/Resources/Private/Templates/ContentElements/SkillDisplaySkillSet.html
@@ -1,14 +1,25 @@
-
- {f:render(partial: 'VerificationBox', arguments: {
- title: skillSet.name,
- count: '{skillSet.skills -> f:count()}',
- detailUrl: 'https://my.skilldisplay.eu/skillset/{skillSet.id}',
- brandLogoUrl: skillSet.brand.logoPublicUrl,
- verificationUrl: '{sd:verification.url(skillSet: skillSet.id, campaign: data.skilldisplay_campaign)}',
- description: skillSet.description
- })}
+ xmlns:sd="http://typo3.org/ns/SkillDisplay/SkilldisplayContent/ViewHelpers"
+ data-namespace-typo3-fluid="true">
+
+
+ {domainGroup.title}
+
+ {skill.title}
+
+
+
+
+
+
+ {f:render(partial: 'VerificationBox', arguments: {
+ title: skillSet.name,
+ count: '{skillSet.skills -> f:count()}',
+ detailUrl: 'https://my.skilldisplay.eu/skillset/{skillSet.id}',
+ brandLogoUrl: skillSet.brand.logoPublicUrl,
+ verificationUrl: '{sd:verification.url(skillSet: skillSet.id, campaign: data.skilldisplay_campaign)}',
+ description: skillSet.description
+ })}
+