* ... * * * @author Claus Due * @package Vhs * @subpackage ViewHelpers\Extension */ class LoadedViewHelper extends AbstractConditionViewHelper { use ConditionViewHelperTrait; /** * Initialize arguments */ public function initializeArguments() { parent::initializeArguments(); $this->registerArgument('extensionName', 'string', 'Name of extension that must be loaded in order to evaluate as TRUE, UpperCamelCase', TRUE); } /** * This method decides if the condition is TRUE or FALSE. It can be overriden in extending viewhelpers to adjust functionality. * * @param array $arguments ViewHelper arguments to evaluate the condition for this ViewHelper, allows for flexiblity in overriding this method. * @return bool */ static protected function evaluateCondition($arguments = NULL) { $extensionName = $arguments['extensionName']; $extensionKey = GeneralUtility::camelCaseToLowerCaseUnderscored($extensionName); $isLoaded = ExtensionManagementUtility::isLoaded($extensionKey); return TRUE === $isLoaded; } }