configurationManager = $configurationManager ?: GeneralUtility::makeInstance(ConfigurationManager::class); } /** * Set POST values * * @param array $postValues Post values of feature * @return mixed */ public function setPostValues(array $postValues) { $this->postValues = $postValues; } /** * Wrapper for isAvailable, used in fluid * * @return bool TRUE if preset is available */ public function getIsAvailable() { return $this->isAvailable(); } /** * Check is preset is currently active on the system * * @return bool TRUE if preset is active */ public function isActive() { $isActive = true; foreach ($this->configurationValues as $configurationKey => $configurationValue) { try { $currentValue = $this->configurationManager->getConfigurationValueByPath($configurationKey); } catch (MissingArrayPathException $e) { $currentValue = null; } if ($currentValue === null && $configurationValue === '__UNSET') { // Preset can define configuration values to be removed using `__UNSET` value handled by // `ArrayUtility::mergeRecursiveWithOverrule()`, retrieving `$currentValue = null`. This // case needs to be skipped to avoid taking the unset value of the other preset to flag // the current preset as inactive. Continue with next value. continue; } if ($currentValue !== $configurationValue) { $isActive = false; break; } } return $isActive; } /** * Wrapper for isActive, used in fluid * * @return bool TRUE if preset is active */ public function getIsActive() { return $this->isActive(); } /** * Get name of preset * * @return string Name */ public function getName() { return $this->name; } /** * Get priority of preset * * @return int Priority, usually between 0 and 100 */ public function getPriority() { return $this->priority; } /** * Get configuration values to activate prefix * * @return array Configuration values needed to activate prefix */ public function getConfigurationValues() { return $this->configurationValues; } }