/** * {@inheritdoc} */ public function updateExtension($type, $name, array $changelist = array(), $safe_only = TRUE) { // If no change list was passed, load one. if (empty($changelist)) { $changelist = $this->configSyncLister->getExtensionChangelist($type, $name, $safe_only); } // Process create changes. if (!empty($changelist['create'])) { foreach ($changelist['create'] as $item_name) { if (!($entity_type = $this->configManager->getEntityTypeIdByName($name))) { $entity_type = 'system.simple'; } $this->configRevert->import($entity_type, $item_name); } } // Process update changes. if (!empty($changelist['update'])) { foreach ($changelist['update'] as $item_name) { if (!($entity_type = $this->configManager->getEntityTypeIdByName($name))) { $entity_type = 'system.simple'; } $this->configRevert->revert($entity_type, $item_name); } } // Refresh the configuration snapshot. $this->configSyncSnapshotter->createExtensionSnapshot($type, $name); }
/** * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { $this->assigner->assignConfigPackages(); $config = $this->featuresManager->getConfigCollection(); $items = array_filter($form_state->getValue('diff')); if (empty($items)) { drupal_set_message('No configuration was selected for import.', 'warning'); return; } foreach ($items as $config_name) { if (isset($config[$config_name])) { $item = $config[$config_name]; $this->configRevert->revert($item['type'], $item['name_short']); } else { $item = $this->featuresManager->getConfigType($config_name); $this->configRevert->import($item['type'], $item['name_short']); } drupal_set_message(t('Imported !name', array('!name' => $config_name))); } }
/** * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { $this->configRevert->revert($this->type, $this->name); drupal_set_message($this->t('The configuration was reverted to its source.')); $form_state->setRedirectUrl($this->getCancelUrl()); }