You are here

protected function FlagListBuilder::getBundles in Flag 8.4

Generates a render array of the applicable bundles for the flag..

Parameters

\Drupal\flag\FlagInterface $flag: The flag entity.

Return value

array A render array of the applicable bundles for the flag..

1 call to FlagListBuilder::getBundles()
FlagListBuilder::buildRow in src/Controller/FlagListBuilder.php
Builds a row for an entity in the entity listing.

File

src/Controller/FlagListBuilder.php, line 102

Class

FlagListBuilder
Provides a entity list page for Flags.

Namespace

Drupal\flag\Controller

Code

protected function getBundles(FlagInterface $flag) {
  $bundles = $flag
    ->getBundles();
  if (empty($bundles)) {
    return [
      '#markup' => '<em>' . $this
        ->t('All') . '</em>',
      '#allowed_tags' => [
        'em',
      ],
    ];
  }
  return [
    '#markup' => implode(', ', $bundles),
  ];
}