You are here

protected function FeaturesEditForm::configLabel in Features 8.3

Same name and namespace in other branches
  1. 8.4 modules/features_ui/src/Form/FeaturesEditForm.php \Drupal\features_ui\Form\FeaturesEditForm::configLabel()

Returns a formatted and sanitized label for a config item.

Parameters

string $type: The config type.

string $key: The short machine name of the item.

string $label: The human label for the item.

1 call to FeaturesEditForm::configLabel()
FeaturesEditForm::getComponentList in modules/features_ui/src/Form/FeaturesEditForm.php
Returns the full feature export array based upon user selections in form_state.

File

modules/features_ui/src/Form/FeaturesEditForm.php, line 943

Class

FeaturesEditForm
Defines the features settings form.

Namespace

Drupal\features_ui\Form

Code

protected function configLabel($type, $key, $label) {
  $value = Html::escape($label);
  if ($key != $label) {
    $value .= '  <span class="config-name">(' . Html::escape($key) . ')</span>';
  }
  if (isset($this->conflicts[$type][$key])) {

    // Show what package the conflict is stored in.
    $config = $this->featuresManager
      ->getConfigCollection();
    $config_name = $this->featuresManager
      ->getFullName($type, $key);
    $package_name = isset($config[$config_name]) ? $config[$config_name]
      ->getPackage() : '';

    // Get the full machine name instead of the short name.
    $packages = $this->featuresManager
      ->getPackages();
    if (isset($packages[$package_name])) {
      $package_name = $packages[$package_name]
        ->getMachineName();
    }
    $value .= '  <span class="config-name">[' . $this
      ->t('in') . ' ' . Html::escape($package_name) . ']</span>';
  }
  return Xss::filterAdmin($value);
}