You are here

protected function WebformSubmissionListBuilder::isSubmissionViewResultsReplaced in Webform 8.5

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

Determine if the submission view(s) replaced the default results table.

Return value

bool TRUE if the submission view(s) replaced the default results table.

2 calls to WebformSubmissionListBuilder::isSubmissionViewResultsReplaced()
WebformSubmissionListBuilder::buildSubmissionViewsMenu in src/WebformSubmissionListBuilder.php
Build the submission views menu.
WebformSubmissionListBuilder::__construct in src/WebformSubmissionListBuilder.php
Constructs a new WebformSubmissionListBuilder object.

File

src/WebformSubmissionListBuilder.php, line 1203

Class

WebformSubmissionListBuilder
Provides a list controller for webform submission entity.

Namespace

Drupal\webform

Code

protected function isSubmissionViewResultsReplaced() {
  $type = $this
    ->getSubmissionViewType();
  $replace_routes = [];
  $default_replace = $this->configFactory
    ->get('webform.settings')
    ->get('settings.default_submission_views_replace') ?: [];
  if (isset($default_replace[$type . '_routes'])) {
    $replace_routes = array_merge($replace_routes, $default_replace[$type . '_routes']);
  }
  if ($this->webform) {
    $webform_replace = $this->webform
      ->getSetting('submission_views_replace') ?: [];
    if (isset($webform_replace[$type . '_routes'])) {
      $replace_routes = array_merge($replace_routes, $webform_replace[$type . '_routes']);
    }
  }
  $route_name = $this->routeMatch
    ->getRouteName();
  return $replace_routes && in_array($route_name, $replace_routes) ? TRUE : FALSE;
}