Same filename and directory in other branches
- 8.9.x core/modules/node/src/NodeTypeListBuilder.php
- 9 core/modules/node/src/NodeTypeListBuilder.php
Namespace
Drupal\node
File
core/modules/node/src/NodeTypeListBuilder.php
View source
<?php
namespace Drupal\node;
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
use Drupal\Core\Url;
use Drupal\Core\Entity\EntityInterface;
class NodeTypeListBuilder extends ConfigEntityListBuilder {
public function buildHeader() {
$header['title'] = t('Name');
$header['description'] = [
'data' => t('Description'),
'class' => [
RESPONSIVE_PRIORITY_MEDIUM,
],
];
return $header + parent::buildHeader();
}
public function buildRow(EntityInterface $entity) {
$row['title'] = [
'data' => $entity
->label(),
'class' => [
'menu-label',
],
];
$row['description']['data'] = [
'#markup' => $entity
->getDescription(),
];
return $row + parent::buildRow($entity);
}
public function getDefaultOperations(EntityInterface $entity) {
$operations = parent::getDefaultOperations($entity);
if (isset($operations['edit'])) {
$operations['edit']['weight'] = 30;
}
return $operations;
}
public function render() {
$build = parent::render();
$build['table']['#empty'] = $this
->t('No content types available. <a href=":link">Add content type</a>.', [
':link' => Url::fromRoute('node.type_add')
->toString(),
]);
return $build;
}
}
Classes