TYPO3 CMS  TYPO3_7-6
AbstractPreset.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
20 abstract class AbstractPreset implements PresetInterface
21 {
25  protected $configurationManager = null;
26 
30  protected $name = '';
31 
35  protected $priority = 50;
36 
40  protected $configurationValues = [];
41 
45  protected $postValues = [];
46 
50  public function injectConfigurationManager(\TYPO3\CMS\Core\Configuration\ConfigurationManager $configurationManager)
51  {
52  $this->configurationManager = $configurationManager;
53  }
54 
61  public function setPostValues(array $postValues)
62  {
63  $this->postValues = $postValues;
64  }
65 
71  public function getIsAvailable()
72  {
73  return $this->isAvailable();
74  }
75 
81  public function isActive()
82  {
83  $isActive = true;
84  foreach ($this->configurationValues as $configurationKey => $configurationValue) {
85  try {
86  $currentValue = $this->configurationManager->getConfigurationValueByPath($configurationKey);
87  } catch (\RuntimeException $e) {
88  $currentValue = null;
89  }
90  if ($currentValue !== $configurationValue) {
91  $isActive = false;
92  break;
93  }
94  }
95  return $isActive;
96  }
97 
103  public function getIsActive()
104  {
105  return $this->isActive();
106  }
107 
113  public function getName()
114  {
115  return $this->name;
116  }
117 
123  public function getPriority()
124  {
125  return $this->priority;
126  }
127 
133  public function getConfigurationValues()
134  {
136  }
137 }
injectConfigurationManager(\TYPO3\CMS\Core\Configuration\ConfigurationManager $configurationManager)