You are here

public function WebformOptionsListBuilder::render in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/WebformOptionsListBuilder.php \Drupal\webform\WebformOptionsListBuilder::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

src/WebformOptionsListBuilder.php, line 63

Class

WebformOptionsListBuilder
Defines a class to build a listing of webform options entities.

Namespace

Drupal\webform

Code

public function render() {

  // Handler autocomplete redirect.
  if ($this->keys && preg_match('#\\(([^)]+)\\)$#', $this->keys, $match)) {
    if ($webform_options = $this
      ->getStorage()
      ->load($match[1])) {
      return new RedirectResponse($webform_options
        ->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.admin.dialog';
  return $build;
}