You are here

UserModuleStatusListBuilder.php in Opigno module 8

Same filename and directory in other branches
  1. 3.x src/UserModuleStatusListBuilder.php

File

src/UserModuleStatusListBuilder.php
View source
<?php

namespace Drupal\opigno_module;

use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityListBuilder;
use Drupal\Core\Link;

/**
 * Defines a class to build a listing of User module status entities.
 *
 * @ingroup opigno_module
 */
class UserModuleStatusListBuilder extends EntityListBuilder {

  /**
   * {@inheritdoc}
   */
  public function buildHeader() {
    $header['id'] = $this
      ->t('User module status ID');
    $header['name'] = $this
      ->t('Name');
    return $header + parent::buildHeader();
  }

  /**
   * {@inheritdoc}
   */
  public function buildRow(EntityInterface $entity) {

    /* @var $entity \Drupal\opigno_module\Entity\UserModuleStatus */
    $row['id'] = $entity
      ->id();
    $row['name'] = Link::createFromRoute($entity
      ->label(), 'entity.user_module_status.edit_form', [
      'user_module_status' => $entity
        ->id(),
    ]);
    return $row + parent::buildRow($entity);
  }

}

Classes

Namesort descending Description
UserModuleStatusListBuilder Defines a class to build a listing of User module status entities.