Update to TYPO3 8.7 LTS
This commit is contained in:
+23
-21
@@ -28,43 +28,45 @@ namespace EP\EpEvents\ViewHelpers;
|
||||
***************************************************************/
|
||||
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
|
||||
use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
|
||||
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
|
||||
|
||||
class ConfiguratorTypeLabelsViewHelper extends AbstractViewHelper
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $settings;
|
||||
use CompileWithRenderStatic;
|
||||
|
||||
/**
|
||||
* @param \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager
|
||||
*/
|
||||
public function injectConfigurationManager(ConfigurationManagerInterface $configurationManager)
|
||||
public function initializeArguments()
|
||||
{
|
||||
$this->settings = $configurationManager->getConfiguration(
|
||||
ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS,
|
||||
'epevents'
|
||||
);
|
||||
parent::initializeArguments();
|
||||
|
||||
$this->registerArgument('type', 'string', 'The type', true);
|
||||
$this->registerArgument('values', 'string', 'The labels', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $type
|
||||
* @param string $values
|
||||
*
|
||||
* @return string
|
||||
* @param array $arguments
|
||||
* @param \Closure $renderChildrenClosure
|
||||
* @param RenderingContextInterface $renderingContext
|
||||
* @return mixed
|
||||
*/
|
||||
public function render($type, $values)
|
||||
public static function renderStatic(
|
||||
array $arguments,
|
||||
\Closure $renderChildrenClosure,
|
||||
RenderingContextInterface $renderingContext
|
||||
)
|
||||
{
|
||||
if (empty($values)) {
|
||||
if (empty($arguments['values'])) {
|
||||
return 'Keine Angabe';
|
||||
}
|
||||
$types = [];
|
||||
$indexes = GeneralUtility::trimExplode(',', $values);
|
||||
$indexes = GeneralUtility::trimExplode(',', $arguments['values']);
|
||||
$templateVariableContainer = $renderingContext->getViewHelperVariableContainer();
|
||||
$settings = $templateVariableContainer['settings'];
|
||||
$type = $arguments['type'];
|
||||
foreach ($indexes as $index)
|
||||
{
|
||||
$types[] = $this->settings['configurator']['options'][$type][$index];
|
||||
$types[] = $settings['configurator']['options'][$type][$index];
|
||||
}
|
||||
return implode(', ', $types);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace EP\EpEvents\ViewHelpers;
|
||||
*
|
||||
* Copyright notice
|
||||
*
|
||||
* (c) 2017 Björn Fromme <[email protected]>, dreipunktnull
|
||||
* (c) 2018 Björn Fromme <[email protected]>, dreipunktnull
|
||||
* Cedric Ziel <[email protected]>, dreipunktnull
|
||||
*
|
||||
* All rights reserved
|
||||
@@ -28,30 +28,51 @@ namespace EP\EpEvents\ViewHelpers;
|
||||
***************************************************************/
|
||||
|
||||
use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
|
||||
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
|
||||
|
||||
class SectionCssClassViewHelper extends AbstractViewHelper
|
||||
{
|
||||
use CompileWithRenderStatic;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $cssClasses = [
|
||||
protected static $cssClasses = [
|
||||
1 => 'incentives',
|
||||
2 => 'teambuilding',
|
||||
3 => 'meetings',
|
||||
4 => 'events',
|
||||
];
|
||||
|
||||
/**
|
||||
* @param string $sectionValue
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function render($sectionValue)
|
||||
public function initializeArguments()
|
||||
{
|
||||
if (array_key_exists($sectionValue, $this->cssClasses)) {
|
||||
return 'section-' . $this->cssClasses[$sectionValue];
|
||||
parent::initializeArguments();
|
||||
|
||||
$this->registerArgument('sectionValue', 'string', 'The section value');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $arguments
|
||||
* @param \Closure $renderChildrenClosure
|
||||
* @param RenderingContextInterface $renderingContext
|
||||
* @return mixed
|
||||
*/
|
||||
public static function renderStatic(
|
||||
array $arguments,
|
||||
\Closure $renderChildrenClosure,
|
||||
RenderingContextInterface $renderingContext
|
||||
)
|
||||
{
|
||||
$sectionValue = $renderChildrenClosure();
|
||||
if ($sectionValue === null) {
|
||||
$sectionValue = $arguments['sectionValue'];
|
||||
}
|
||||
if (array_key_exists($sectionValue, static::$cssClasses)) {
|
||||
return 'section-' . static::$cssClasses[$sectionValue];
|
||||
}
|
||||
|
||||
return 'section-default';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace EP\EpEvents\ViewHelpers;
|
||||
*
|
||||
* Copyright notice
|
||||
*
|
||||
* (c) 2017 Björn Fromme <[email protected]>, dreipunktnull
|
||||
* (c) 2018 Björn Fromme <[email protected]>, dreipunktnull
|
||||
* Cedric Ziel <[email protected]>, dreipunktnull
|
||||
*
|
||||
* All rights reserved
|
||||
@@ -28,31 +28,52 @@ namespace EP\EpEvents\ViewHelpers;
|
||||
***************************************************************/
|
||||
|
||||
use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
|
||||
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
|
||||
|
||||
class SectionIconViewHelper extends AbstractViewHelper
|
||||
{
|
||||
use CompileWithRenderStatic;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $icons = [
|
||||
protected static $icons = [
|
||||
1 => 'icon_incentives',
|
||||
2 => 'icon_teambuilding',
|
||||
3 => 'icon_meetings',
|
||||
4 => 'icon_events',
|
||||
];
|
||||
|
||||
/**
|
||||
* @param string $sectionValue
|
||||
* @param bool $opaque
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function render($sectionValue, $opaque = false)
|
||||
public function initializeArguments()
|
||||
{
|
||||
parent::initializeArguments();
|
||||
|
||||
$this->registerArgument('sectionValue', 'string', 'The section value');
|
||||
$this->registerArgument('opaque', 'bool', 'Whether to use opaque icon', false, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $arguments
|
||||
* @param \Closure $renderChildrenClosure
|
||||
* @param RenderingContextInterface $renderingContext
|
||||
* @return mixed
|
||||
*/
|
||||
public static function renderStatic(
|
||||
array $arguments,
|
||||
\Closure $renderChildrenClosure,
|
||||
RenderingContextInterface $renderingContext
|
||||
)
|
||||
{
|
||||
$sectionValue = $renderChildrenClosure();
|
||||
if ($sectionValue === null) {
|
||||
$sectionValue = $arguments['sectionValue'];
|
||||
}
|
||||
|
||||
$icon = '';
|
||||
if (array_key_exists($sectionValue, $this->icons)) {
|
||||
$icon = $this->icons[$sectionValue];
|
||||
if ($opaque) {
|
||||
if (array_key_exists($sectionValue, static::$icons)) {
|
||||
$icon = static::$icons[$sectionValue];
|
||||
if ($arguments['opaque']) {
|
||||
$icon .= '_opaque';
|
||||
}
|
||||
$icon .= '.svg';
|
||||
@@ -60,4 +81,5 @@ class SectionIconViewHelper extends AbstractViewHelper
|
||||
|
||||
return $icon;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace EP\EpEvents\ViewHelpers;
|
||||
*
|
||||
* Copyright notice
|
||||
*
|
||||
* (c) 2017 Björn Fromme <[email protected]>, dreipunktnull
|
||||
* (c) 2018 Björn Fromme <[email protected]>, dreipunktnull
|
||||
* Cedric Ziel <[email protected]>, dreipunktnull
|
||||
*
|
||||
* All rights reserved
|
||||
@@ -28,20 +28,43 @@ namespace EP\EpEvents\ViewHelpers;
|
||||
***************************************************************/
|
||||
|
||||
use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
|
||||
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
|
||||
|
||||
class SoftHyphenViewHelper extends AbstractViewHelper
|
||||
{
|
||||
use CompileWithRenderStatic;
|
||||
|
||||
/**
|
||||
* @param string $string
|
||||
*
|
||||
* @return string
|
||||
* @var bool
|
||||
*/
|
||||
public function render($string = null)
|
||||
protected $escapeOutput = false;
|
||||
|
||||
public function initializeArguments()
|
||||
{
|
||||
parent::initializeArguments();
|
||||
|
||||
$this->registerArgument('string', 'string', 'The string to process');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $arguments
|
||||
* @param \Closure $renderChildrenClosure
|
||||
* @param RenderingContextInterface $renderingContext
|
||||
* @return mixed
|
||||
*/
|
||||
public static function renderStatic(
|
||||
array $arguments,
|
||||
\Closure $renderChildrenClosure,
|
||||
RenderingContextInterface $renderingContext
|
||||
)
|
||||
{
|
||||
$string = $renderChildrenClosure();
|
||||
if ($string === null) {
|
||||
$string = $this->renderChildren();
|
||||
$string = $arguments['string'];
|
||||
}
|
||||
|
||||
return str_replace('--', '­', $string);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user