You are here

protected function EntityViewDisplayAlterer::getSummaryFromSettings in Smart Title 8

Returns the summary of Smart Title.

Parameters

string[] $smart_title_settings: The active smart title settings.

\Drupal\Core\Entity\Display\EntityViewDisplayInterface $entity: The view display config entity.

Return value

string[] The summary (each array value is a line).

1 call to EntityViewDisplayAlterer::getSummaryFromSettings()
EntityViewDisplayAlterer::addSmartTitle in src/EntityViewDisplayAlterer.php
Adds Smart Title to the entity form.

File

src/EntityViewDisplayAlterer.php, line 361

Class

EntityViewDisplayAlterer
Entity view display form alterer class for Smart Title.

Namespace

Drupal\smart_title

Code

protected function getSummaryFromSettings(array $smart_title_settings, EntityViewDisplayInterface $entity) {
  $summary = [];
  foreach ($smart_title_settings as $key => $value) {
    if ($key === 'smart_title__link') {
      if ((bool) $value) {
        $summary[] = _smart_title_defaults('', NULL, 'smart_title__link')['label'];
      }
      continue;
    }
    if ($key === 'smart_title__classes') {
      $value = empty($smart_title_settings['smart_title__tag']) ? FALSE : implode(', ', $value);
    }
    if ((bool) $value) {
      $summary[] = _smart_title_defaults('', NULL, $key)['label'] . ': ' . $value;
    }
  }
  return $summary;
}