diff --git a/drush/features.drush.inc b/drush/features.drush.inc index fd33551..d913ce5 100644 --- a/drush/features.drush.inc +++ b/drush/features.drush.inc @@ -605,15 +605,15 @@ function drush_features_import() { $dt_args['@component'] = $component; $confirmation_message = 'Do you really want to import @module : @component?'; if ($skip_confirmation || drush_confirm(dt($confirmation_message, $dt_args))) { - /** @var \Drupal\features\ConfigurationItem $item */ if (!isset($config[$component])) { // Import missing component. $item = $manager->getConfigType($component); - $config_revert->import($item->getType(), $item->getShortName()); + $config_revert->import($item['type'], $item['name_short']); drush_log(dt('Import @module : @component.', $dt_args), 'ok'); } else { // Revert existing component. + /** @var \Drupal\features\ConfigurationItem $item */ $item = $config[$component]; $config_revert->revert($item->getType(), $item->getShortName()); drush_log(dt('Reverted @module : @component.', $dt_args), 'ok'); diff --git a/modules/features_ui/src/Form/FeaturesEditForm.php b/modules/features_ui/src/Form/FeaturesEditForm.php index 239abe0..704631e 100644 --- a/modules/features_ui/src/Form/FeaturesEditForm.php +++ b/modules/features_ui/src/Form/FeaturesEditForm.php @@ -520,12 +520,12 @@ class FeaturesEditForm extends FormBase { foreach ($config as $item_name => $item) { if (($item->getPackage() != $package_name) && !empty($packages[$item->getPackage()]) && ($packages[$item->getPackage()]['status'] != FeaturesManagerInterface::STATUS_NO_EXPORT)) { - $this->conflicts[$item->getType()][$item->getShortName()] = $item; + $this->conflicts[$item->getType()][$item->getShortName()] = $item->getLabel(); } if ($this->allowConflicts || !isset($this->conflicts[$item->getType()][$item->getShortName()]) || (!empty($this->package['config_orig']) && in_array($item_name, $this->package['config_orig']))) { - $components[$item->getType()][$item->getShortName()] = $item; + $components[$item->getType()][$item->getShortName()] = $item->getLabel(); } } @@ -536,7 +536,7 @@ class FeaturesEditForm extends FormBase { $item = $config[$item_name]; // Remove any conflicts if those are not being allowed. // if ($this->allowConflicts || !isset($this->conflicts[$item['type']][$item['name_short']])) { - $exported_features_info[$item->getType()][$item->getShortName()] = $item; + $exported_features_info[$item->getType()][$item->getShortName()] = $item->getLabel(); // } } } @@ -548,7 +548,7 @@ class FeaturesEditForm extends FormBase { $info = !empty($this->package['info']['features'][$constraint]) ? $this->package['info']['features'][$constraint] : array(); foreach ($info as $item_name) { $item = $config[$item_name]; - $this->{$constraint}[$item->getType()][$item->getShortName()] = $item; + $this->{$constraint}[$item->getType()][$item->getShortName()] = $item->getLabel(); } } @@ -556,7 +556,7 @@ class FeaturesEditForm extends FormBase { $new_features_info = array(); foreach ($this->package['config'] as $item_name) { $item = $config[$item_name]; - $new_features_info[$item->getType()][$item->getShortName()] = $item; + $new_features_info[$item->getType()][$item->getShortName()] = $item->getLabel(); } $new_features_info['dependencies'] = !empty($this->package['dependencies']) ? $this->package['dependencies'] : array(); @@ -616,13 +616,13 @@ class FeaturesEditForm extends FormBase { $exported_components = !empty($exported_features_info[$component]) ? $exported_features_info[$component] : array(); $new_components = !empty($new_features_info[$component]) ? $new_features_info[$component] : array(); - foreach ($component_info as $key => $value) { + foreach ($component_info as $key => $label) { $config_name = $this->featuresManager->getFullName($component, $key); // If checkbox in Sources is checked, move it to Added section. if (!$form_state->isValueEmpty(array($component, 'sources', 'selected', $key))) { $form_state->setValue(array($component, 'sources', 'selected', $key), FALSE); $form_state->setValue(array($component, 'added', $key), 1); - $component_export['options']['added'][$key] = $this->configLabel($component, $key, $value['label']); + $component_export['options']['added'][$key] = $this->configLabel($component, $key, $label); $component_export['selected']['added'][$key] = $key; // If this was previously excluded, we don't need to set it as // required because it was automatically assigned. @@ -690,7 +690,7 @@ class FeaturesEditForm extends FormBase { $default_value = FALSE; } } - $component_export['options'][$section][$key] = $this->configLabel($component, $key, $value['label']); + $component_export['options'][$section][$key] = $this->configLabel($component, $key, $label); $component_export['selected'][$section][$key] = $default_value; // Save which dependencies are specifically excluded from // auto-detection. @@ -728,7 +728,7 @@ class FeaturesEditForm extends FormBase { elseif (!$form_state->isSubmitted() && isset($exported_components[$key])) { // Component is not part of new export, but was in original export. // Mark component as Added when creating initial form. - $component_export['options']['added'][$key] = $this->configLabel($component, $key, $value['label']); + $component_export['options']['added'][$key] = $this->configLabel($component, $key, $label); $component_export['selected']['added'][$key] = $key; } else { @@ -737,7 +737,7 @@ class FeaturesEditForm extends FormBase { foreach (array('included', 'added') as $section) { // Restore any user-selected checkboxes. if (!$form_state->isValueEmpty(array($component, $section, $key))) { - $component_export['options'][$section][$key] = $this->configLabel($component, $key, $value['label']); + $component_export['options'][$section][$key] = $this->configLabel($component, $key, $label); $component_export['selected'][$section][$key] = $key; $added = TRUE; } @@ -745,7 +745,7 @@ class FeaturesEditForm extends FormBase { if (!$added) { // If not Included or Added, then put it back in the unchecked // Sources checkboxes. - $component_export['options']['sources'][$key] = $this->configLabel($component, $key, $value['label']); + $component_export['options']['sources'][$key] = $this->configLabel($component, $key, $label); $component_export['selected']['sources'][$key] = FALSE; } } diff --git a/src/FeaturesManager.php b/src/FeaturesManager.php index aeda7d1..6c954cd 100644 --- a/src/FeaturesManager.php +++ b/src/FeaturesManager.php @@ -496,7 +496,7 @@ class FeaturesManager implements FeaturesManagerInterface { $already_assigned = !empty($config_collection[$item_name]->getPackage()); // If this is the profile package, we can reassign extension-provided configuration. $assignable = (!$extension_provided || $this->getAssigner()->getBundle($package['bundle'])->isProfilePackage($package['machine_name'])); - $excluded_from_package = in_array($package_name, $config_collection[$item_name]['package_excluded']); + $excluded_from_package = in_array($package_name, $config_collection[$item_name]->getPackageExcluded()); $already_in_package = in_array($item_name, $package['config']); if (($force || (!$already_assigned && $assignable && !$excluded_from_package)) && !$already_in_package) { // Add the item to the package's config array. @@ -954,16 +954,16 @@ class FeaturesManager implements FeaturesManagerInterface { } $config_collection[$name] = (new ConfigurationItem($name, $data, [ - 'name_short' => $item_name, + 'shortName' => $item_name, 'label' => $label, 'type' => $config_type, 'dependents' => array_keys($dependents), // Default to the install directory. 'subdirectory' => InstallStorage::CONFIG_INSTALL_DIRECTORY, 'package' => '', - 'extension_provided' => NULL, - 'providing_feature' => isset($existing_config[$name]) ? $existing_config[$name] : NULL, - 'package_excluded' => [], + 'extensionProvided' => NULL, + 'providingFeature' => isset($existing_config[$name]) ? $existing_config[$name] : NULL, + 'packageExcluded' => [], ])); } } diff --git a/src/Plugin/FeaturesAssignment/FeaturesAssignmentBaseType.php b/src/Plugin/FeaturesAssignment/FeaturesAssignmentBaseType.php index f72a339..833cf57 100644 --- a/src/Plugin/FeaturesAssignment/FeaturesAssignmentBaseType.php +++ b/src/Plugin/FeaturesAssignment/FeaturesAssignmentBaseType.php @@ -41,7 +41,7 @@ class FeaturesAssignmentBaseType extends FeaturesAssignmentMethodBase { foreach ($config_collection as $item_name => $item) { if (in_array($item->getType(), $config_base_types)) { - if (!isset($packages[$item['name_short']]) && !$item->getPackage()) { + if (!isset($packages[$item->getShortName()]) && !$item->getPackage()) { $description = $this->t('Provide @label @type and related configuration.', array('@label' => $item->getLabel(), '@type' => Unicode::strtolower($config_types[$item->getType()]))); if (isset($item->getData()['description'])) { $description .= ' ' . $item->getData()['description']; diff --git a/src/Plugin/FeaturesAssignment/FeaturesAssignmentExclude.php b/src/Plugin/FeaturesAssignment/FeaturesAssignmentExclude.php index 822fda8..f5b880a 100644 --- a/src/Plugin/FeaturesAssignment/FeaturesAssignmentExclude.php +++ b/src/Plugin/FeaturesAssignment/FeaturesAssignmentExclude.php @@ -95,7 +95,7 @@ class FeaturesAssignmentExclude extends FeaturesAssignmentMethodBase { if (isset($config_collection[$item_name])) { // Flag extension-provided configuration, which should not be added // to regular features but can be added to an install profile. - $config_collection[$item_name]['extension_provided'] = TRUE; + $config_collection[$item_name]->setExtensionProvided(TRUE); } } }