You are here

public function WebformOptionsCustomListBuilder::render in Webform 8.5

Same name and namespace in other branches
  1. 6.x modules/webform_options_custom/src/WebformOptionsCustomListBuilder.php \Drupal\webform_options_custom\WebformOptionsCustomListBuilder::render()

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

modules/webform_options_custom/src/WebformOptionsCustomListBuilder.php, line 68

Class

WebformOptionsCustomListBuilder
Defines a class to build a listing of webform options custom entities.

Namespace

Drupal\webform_options_custom

Code

public function render() {

  // Handler autocomplete redirect.
  if ($this->keys && preg_match('#\\(([^)]+)\\)$#', $this->keys, $match)) {
    if ($webform_options_custom = $this
      ->getStorage()
      ->load($match[1])) {
      return new RedirectResponse($webform_options_custom
        ->toUrl()
        ->setAbsolute(TRUE)
        ->toString());
    }
  }
  $build = [];

  // Filter form.
  $build['filter_form'] = $this
    ->buildFilterForm();

  // Display info.
  $build['info'] = $this
    ->buildInfo();

  // Table.
  $build += parent::render();
  $build['table']['#sticky'] = TRUE;

  // Attachments.
  $build['#attached']['library'][] = 'webform/webform.tooltip';
  $build['#attached']['library'][] = 'webform/webform.admin.dialog';
  return $build;
}