| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- namespace Meramo\mrm_be\Hooks\PageLayoutView;
- /*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
- use \TYPO3\CMS\Core\Utility\GeneralUtility;
- use \TYPO3\CMS\Core\Service\FlexFormService;
- use \TYPO3\CMS\Backend\View\PageLayoutViewDrawItemHookInterface;
- use \TYPO3\CMS\Backend\View\PageLayoutView;
- /**
- * Contains a preview rendering for the page module of CType="mrm_be_cm_introtext"
- */
- class MrmBeCmLinkagePreviewRenderer implements PageLayoutViewDrawItemHookInterface
- {
- /**
- * Preprocesses the preview rendering of a content element of type "My new content element"
- *
- * @param \TYPO3\CMS\Backend\View\PageLayoutView $parentObject Calling parent object
- * @param bool $drawItem Whether to draw the item using the default functionality
- * @param string $headerContent Header content
- * @param string $itemContent Item content
- * @param array $row Record row of tt_content
- *
- * @return void
- */
- public function preProcess(
- PageLayoutView &$parentObject,
- &$drawItem,
- &$headerContent,
- &$itemContent,
- array &$row
- )
- {
- if ($row['CType'] === 'mrm_be_cm_linkage') {
- $headerContent = '<b>'.\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('LLL:EXT:mrm_be/Resources/Private/Language/locallang_ttc.xlf:'.$row['CType'].'.title', '').'</b>';
- $ffs = GeneralUtility::makeInstance(FlexFormService::class);
- $flex = $ffs->convertFlexFormContentToArray($row['pi_flexform']);
- $linkCount = $flex['dynamicComponents'] ? sizeof($flex['dynamicComponents']) : 0;
- $berufenetCount = $flex['dynamicComponentsBerufeNet'] ? sizeof($flex['dynamicComponentsBerufeNet']) : 0;
- $berufsausbildungCount = $flex['dynamicComponentsBerufsausbildung'] ? sizeof($flex['dynamicComponentsBerufsausbildung']) : 0;
- $berufetvCount = $flex['dynamicComponentsBerufeTV'] ? sizeof($flex['dynamicComponentsBerufeTV']) : 0;
- $ba_searchCount = $flex['dynamicComponentsBASearch'] ? sizeof($flex['dynamicComponentsBASearch']) : 0;
- $studienwahlCount = $flex['dynamicComponentsStudienwahl'] ? sizeof($flex['dynamicComponentsStudienwahl']) : 0;
- $itemContent .= '<div style="display: flex; flex-direction: row; justify-content: flex-start;"><img src="/typo3conf/ext/mrm_be/Resources/Public/Icons/'.$row['CType'].'.svg" style="width: 32px; height: 32px; margin-right: 6px;"><div style="display: flex; flex-direction: column; min-width: 0;"><strong>'.\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('LLL:EXT:mrm_be/Resources/Private/Language/locallang_ttc.xlf:'.$row['CType'].'.title', '').':</strong><em style="white-space:nowrap; overflow:hidden;text-overflow: ellipsis;">'.$linkCount.'×Vernetzung<br/>'.$berufsausbildungCount.'×Berufsausbildung</br>'.$berufetvCount.'×BERUFETV<br/>'.$ba_searchCount.'×BA-Studiensuche<br/>'.$studienwahlCount.'×Studienwahl<br/>Check-U-Link? '.(($flex['enable_check_u'] == true) ? '✓' : '×').'<br/>Studiencheck-Link? '.(($flex['enable_studiencheck'] == true) ? '✓' : '×').'</em></div></div>';
- $drawItem = false;
- }
- }
- }
|