You are here

public function DynamicLayoutListBuilder::buildHeader in Dynamic Layouts 8

Builds the header row for the entity listing.

Return value

array A render array structure of header strings.

Overrides EntityListBuilder::buildHeader

See also

\Drupal\Core\Entity\EntityListBuilder::render()

File

src/DynamicLayoutListBuilder.php, line 74

Class

DynamicLayoutListBuilder
Defines a class to build a listing of user Dynamic Layouts.

Namespace

Drupal\dynamic_layouts

Code

public function buildHeader() {

  /** @var \Drupal\dynamic_layouts\DynamicLayoutSettingsInterface $settings */
  if (($settings = $this->entityTypeManager
    ->getStorage('dynamic_layout_settings')
    ->load('settings')) && !$settings
    ->getFrontendLibrary()) {
    $settings_link = Link::fromTextAndUrl(t('here'), Url::fromRoute('dynamic_layout.dynamic_layout_settings'))
      ->toString();

    // Display a message.
    $this
      ->messenger()
      ->addWarning(t('Before creating a layout, please configure your settings @link!', array(
      '@link' => $settings_link,
    )));
  }
  $header['label'] = t('Name');
  $header['category'] = t('Category');
  return $header + parent::buildHeader();
}