You are here

public function ContactEmailListBuilder::render in Contact Emails 8

Builds the entity listing as renderable array for table.html.twig.

@todo Add a link to add a new item to the #empty text.

Overrides EntityListBuilder::render

File

src/ContactEmailListBuilder.php, line 49

Class

ContactEmailListBuilder
Defines the list builder for tax services.

Namespace

Drupal\contact_emails

Code

public function render() {
  $build = parent::render();

  // If this is a list for a particular contact form, set a useful empty
  // message.
  if ($contact_form = \Drupal::routeMatch()
    ->getParameter('contact_form')) {
    $build['table']['#empty'] = $this
      ->t('The default contact emails are being used. <a href=":url_edit">Modify the default emails here</a> or <a href=":url_create">override them with new contact emails</a>.', [
      ':url_edit' => Url::fromRoute('entity.contact_form.edit_form', [
        'contact_form' => $contact_form,
      ])
        ->toString(),
      ':url_create' => Url::fromRoute('entity.contact_email.add_form', [
        'contact_form' => $contact_form,
      ])
        ->toString(),
    ]);
  }
  return $build;
}