You are here

public function TagPluginCollection::getSummary in Extensible BBCode 8.3

Same name and namespace in other branches
  1. 4.0.x src/TagPluginCollection.php \Drupal\xbbcode\TagPluginCollection::getSummary()

Generate a list of configured tags for display.

Return value

array A render element.

File

src/TagPluginCollection.php, line 90

Class

TagPluginCollection
A collection of tag plugins.

Namespace

Drupal\xbbcode

Code

public function getSummary() : array {
  $tags = [
    '#theme' => 'item_list',
    '#context' => [
      'list_style' => 'comma-list',
    ],
    '#items' => [],
    '#empty' => $this
      ->t('None'),
    '#attached' => [
      'library' => [
        'xbbcode/filter-tips',
      ],
    ],
    '#attributes' => [
      'class' => [
        'xbbcode-filter-tips',
      ],
    ],
  ];
  foreach ($this as $name => $tag) {
    $tags['#items'][$name] = [
      '#type' => 'inline_template',
      '#template' => '<abbr title="{{ tag.description }}">[{{ tag.name }}]</abbr>',
      '#context' => [
        'tag' => $tag,
      ],
    ];
  }
  return $tags;
}