You are here

public function ContactListBuilder::render in Examples for Developers 3.x

Same name and namespace in other branches
  1. 8 content_entity_example/src/Entity/Controller/ContactListBuilder.php \Drupal\content_entity_example\Entity\Controller\ContactListBuilder::render()

We override ::render() so that we can add our own content above the table. parent::render() is where EntityListBuilder creates the table using our buildHeader() and buildRow() implementations.

Overrides EntityListBuilder::render

File

modules/content_entity_example/src/Entity/Controller/ContactListBuilder.php, line 59

Class

ContactListBuilder
Provides a list controller for content_entity_example entity.

Namespace

Drupal\content_entity_example\Entity\Controller

Code

public function render() {
  $build['description'] = [
    '#markup' => $this
      ->t('Content Entity Example implements a Contacts model. These contacts are fieldable entities. You can manage the fields on the <a href="@adminlink">Contacts admin page</a>.', [
      '@adminlink' => $this->urlGenerator
        ->generateFromRoute('content_entity_example.contact_settings'),
    ]),
  ];
  $build['table'] = parent::render();
  return $build;
}