FormAssemblyEntityListBuilder.php in FormAssembly 8
Namespace
Drupal\formassemblyFile
src/FormAssemblyEntityListBuilder.phpView source
<?php
namespace Drupal\formassembly;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityListBuilder;
use Drupal\Core\Link;
use Drupal\Core\Url;
/**
* Defines a class to build a listing of FormAssembly Form entities.
*
* @author Shawn P. Duncan <code@sd.shawnduncan.org>
*
* Copyright 2018 by Shawn P. Duncan. This code is
* released under the GNU General Public License.
* Which means that it is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
* http://www.gnu.org/licenses/gpl.html
* @ingroup formassembly
*/
class FormAssemblyEntityListBuilder extends EntityListBuilder {
/**
* {@inheritdoc}
*/
public function buildHeader() {
$header['id'] = $this
->t('FormAssembly Form ID');
$header['name'] = $this
->t('Name');
$header['status'] = $this
->t('Status');
return $header + parent::buildHeader();
}
/**
* {@inheritdoc}
*/
public function buildRow(EntityInterface $entity) {
/* @var $entity \Drupal\formassembly\Entity\FormAssemblyEntity */
$row['id'] = $entity
->id();
$row['name'] = Link::fromTextAndUrl($entity
->label(), new Url('entity.fa_form.canonical', [
'fa_form' => $entity
->id(),
]));
$row['status'] = $entity
->getStatus() ? $this
->t('Enabled') : $this
->t('Archived');
return $row + parent::buildRow($entity);
}
}
Classes
Name | Description |
---|---|
FormAssemblyEntityListBuilder | Defines a class to build a listing of FormAssembly Form entities. |