You are here

protected function WebformSubmissionListBuilder::buildCustomizeButton in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/WebformSubmissionListBuilder.php \Drupal\webform\WebformSubmissionListBuilder::buildCustomizeButton()

Build the customize button.

Return value

array A render array representing the customize button.

1 call to WebformSubmissionListBuilder::buildCustomizeButton()
WebformSubmissionListBuilder::buildEntityList in src/WebformSubmissionListBuilder.php
Build the webform submission entity list.

File

src/WebformSubmissionListBuilder.php, line 694

Class

WebformSubmissionListBuilder
Provides a list controller for webform submission entity.

Namespace

Drupal\webform

Code

protected function buildCustomizeButton() {
  $results_customize = $this->webform
    ->getSetting('results_customize', TRUE);
  $title = $results_customize ? $this
    ->t('Customize my table') : $this
    ->t('Customize');
  $route_name = $this->requestHandler
    ->getRouteName($this->webform, $this->sourceEntity, 'webform.results_submissions.custom' . ($results_customize ? '.user' : ''));
  $route_parameters = $this->requestHandler
    ->getRouteParameters($this->webform, $this->sourceEntity);
  return [
    '#type' => 'link',
    '#title' => $title,
    '#url' => $this
      ->ensureDestination(Url::fromRoute($route_name, $route_parameters)),
    '#attributes' => WebformDialogHelper::getModalDialogAttributes(WebformDialogHelper::DIALOG_NORMAL, [
      'button',
      'button-action',
      'button--small',
      'button-webform-table-setting',
    ]),
  ];
}