You are here

protected function FeatureManageForm::getDescription in Configuration selector 8

Same name and namespace in other branches
  1. 8.2 src/Form/FeatureManageForm.php \Drupal\config_selector\Form\FeatureManageForm::getDescription()

Gets a description of the config entity.

If the configuration entity has a description field or implements a getDescription() method that will be used. Otherwise descriptions can be add to the config_selector third party settings.

Parameters

\Drupal\Core\Config\Entity\ConfigEntityInterface $entity: The config entity to get the description for.

Return value

\Drupal\Core\StringTranslation\TranslatableMarkup|string The config entity description.

1 call to FeatureManageForm::getDescription()
FeatureManageForm::form in src/Form/FeatureManageForm.php
Gets the actual form array to be built.

File

src/Form/FeatureManageForm.php, line 121

Class

FeatureManageForm
Builds the feature manage form.

Namespace

Drupal\config_selector\Form

Code

protected function getDescription(ConfigEntityInterface $entity) {
  if (method_exists($entity, 'getDescription')) {
    $description = $entity
      ->getDescription();
  }
  else {

    // This handles Views and anything with a description property.
    $description = $entity
      ->get('description');
  }

  // Be cautious about what we return as we're not using an interface to
  // enforce a return value.
  if (is_string($description) || $description instanceof TranslatableMarkup) {
    return $description;
  }
  return $entity
    ->getThirdPartySetting('config_selector', 'description', '');
}