X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fnode%2Fsrc%2FNodeTypeListBuilder.php;fp=web%2Fcore%2Fmodules%2Fnode%2Fsrc%2FNodeTypeListBuilder.php;h=be6e5f638b909a37e6dd288ca01160ca4731fd99;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/web/core/modules/node/src/NodeTypeListBuilder.php b/web/core/modules/node/src/NodeTypeListBuilder.php new file mode 100644 index 000000000..be6e5f638 --- /dev/null +++ b/web/core/modules/node/src/NodeTypeListBuilder.php @@ -0,0 +1,64 @@ + t('Description'), + 'class' => [RESPONSIVE_PRIORITY_MEDIUM], + ]; + return $header + parent::buildHeader(); + } + + /** + * {@inheritdoc} + */ + public function buildRow(EntityInterface $entity) { + $row['title'] = [ + 'data' => $entity->label(), + 'class' => ['menu-label'], + ]; + $row['description']['data'] = ['#markup' => $entity->getDescription()]; + return $row + parent::buildRow($entity); + } + + /** + * {@inheritdoc} + */ + public function getDefaultOperations(EntityInterface $entity) { + $operations = parent::getDefaultOperations($entity); + // Place the edit operation after the operations added by field_ui.module + // which have the weights 15, 20, 25. + if (isset($operations['edit'])) { + $operations['edit']['weight'] = 30; + } + return $operations; + } + + /** + * {@inheritdoc} + */ + public function render() { + $build = parent::render(); + $build['table']['#empty'] = $this->t('No content types available. Add content type.', [ + ':link' => Url::fromRoute('node.type_add')->toString() + ]); + return $build; + } + +}