TYPO3 CMS  TYPO3_6-2
ConfigurationController.php
Go to the documentation of this file.
1 <?php
3 
19 
26 
32 
38 
47  public function showConfigurationFormAction(array $extension) {
48  if (!array_key_exists('key', $extension)) {
49  throw new ExtensionManagerException(
50  'Extension key not found.',
51  1359206803
52  );
53  }
54  $configuration = $this->configurationItemRepository->findByExtensionKey($extension['key']);
55  if ($configuration) {
56  $this->view
57  ->assign('configuration', $configuration)
58  ->assign('extension', $extension);
59  } else {
61  $extension = $this->extensionRepository->findOneByCurrentVersionByExtensionKey($extension['key']);
62  // Extension has no configuration and is a distribution
63  if ($extension->getCategory() === Extension::DISTRIBUTION_CATEGORY) {
64  $this->redirect('welcome', 'Distribution', NULL, array('extension' => $extension->getUid()));
65  }
66  throw new ExtensionManagerException('The extension ' . htmlspecialchars($extension['key']) . ' has no configuration.');
67  }
68  }
69 
78  public function saveAction(array $config, $extensionKey) {
79  $this->saveConfiguration($config, $extensionKey);
81  $extension = $this->extensionRepository->findOneByCurrentVersionByExtensionKey($extensionKey);
82  // Different handling for distribution installation
83  if ($extension instanceof Extension &&
85  ) {
86  $this->redirect('welcome', 'Distribution', NULL, array('extension' => $extension->getUid()));
87  } else {
88  $this->redirect('showConfigurationForm', NULL, NULL, array('extension' => array('key' => $extensionKey)));
89  }
90  }
91 
99  public function saveAndCloseAction(array $config, $extensionKey) {
100  $this->saveConfiguration($config, $extensionKey);
101  $this->redirect('index', 'List');
102  }
103 
104 
110  protected function emitAfterExtensionConfigurationWriteSignal(array $newConfiguration) {
111  $this->signalSlotDispatcher->dispatch(__CLASS__, 'afterExtensionConfigurationWrite', array($newConfiguration, $this));
112  }
113 
121  protected function saveConfiguration(array $config, $extensionKey) {
123  $configurationUtility = $this->objectManager->get('TYPO3\\CMS\\Extensionmanager\\Utility\\ConfigurationUtility');
124  $newConfiguration = $configurationUtility->getCurrentConfiguration($extensionKey);
126  $configurationUtility->writeConfiguration(
127  $configurationUtility->convertValuedToNestedConfiguration($newConfiguration),
128  $extensionKey
129  );
130  $this->emitAfterExtensionConfigurationWriteSignal($newConfiguration);
131  }
132 
133 }
static mergeRecursiveWithOverrule(array &$original, array $overrule, $addKeys=TRUE, $includeEmptyValues=TRUE, $enableUnsetFeature=TRUE)
redirect($actionName, $controllerName=NULL, $extensionName=NULL, array $arguments=NULL, $pageUid=NULL, $delay=0, $statusCode=303)