You are here

LayoutBuilderStyleListBuilder.php in Layout Builder Styles 8

File

src/LayoutBuilderStyleListBuilder.php
View source
<?php

namespace Drupal\layout_builder_styles;

use Drupal\Core\Config\Entity\DraggableListBuilder;
use Drupal\Core\Entity\EntityInterface;

/**
 * Provides a listing of layout builder style entities.
 */
class LayoutBuilderStyleListBuilder extends DraggableListBuilder {

  /**
   * {@inheritdoc}
   */
  public function getFormId() {
    return 'layout_builder_styles_admin_overview_form';
  }

  /**
   * {@inheritdoc}
   */
  public function buildHeader() {
    $header['label'] = $this
      ->t('Label');
    $header['id'] = $this
      ->t('Machine name');
    $header['type'] = $this
      ->t('Type');
    return $header + parent::buildHeader();
  }

  /**
   * {@inheritdoc}
   */
  public function buildRow(EntityInterface $entity) {
    $row = [];
    $row['label'] = $entity
      ->label();
    $row['id'] = [
      '#plain_text' => $entity
        ->id(),
    ];
    $row['type'] = [
      '#plain_text' => $entity
        ->getType(),
    ];
    return $row + parent::buildRow($entity);
  }

}

Classes

Namesort descending Description
LayoutBuilderStyleListBuilder Provides a listing of layout builder style entities.