class VisualNIFrameListBuilder

Defines a class to build a listing of VisualN IFrame entities.

Hierarchy

Expanded class hierarchy of VisualNIFrameListBuilder

Related topics

File

modules/visualn_iframe/src/VisualNIFrameListBuilder.php, line 18

Namespace

Drupal\visualn_iframe
View source
class VisualNIFrameListBuilder extends EntityListBuilder {

  // @todo: add by hash filter
  //   use views instead of list builder (see /admin/structure/views/view/content view)

  /**
   * {@inheritdoc}
   */
  public function buildHeader() {
    $header['id'] = $this
      ->t('ID');
    $header['hash'] = $this
      ->t('Hash');
    $header['handler_key'] = $this
      ->t('Handler key');
    $header['name'] = $this
      ->t('Name');
    return $header + parent::buildHeader();
  }

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

    /* @var $entity \Drupal\visualn_iframe\Entity\VisualNIFrame */
    $row['id'] = $entity
      ->id();
    $row['hash'] = $entity
      ->getHash();

    // @todo: use getter for handler_key
    $row['handler_key'] = $entity
      ->get('handler_key')->value;
    $row['name'] = Link::createFromRoute($entity
      ->label(), 'entity.visualn_iframe.edit_form', [
      'visualn_iframe' => $entity
        ->id(),
    ]);
    return $row + parent::buildRow($entity);
  }

}

Members