You are here

public function DisplayPluginBase::isIdentifierUnique in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/src/Plugin/views/display/DisplayPluginBase.php \Drupal\views\Plugin\views\display\DisplayPluginBase::isIdentifierUnique()

Checks if the provided identifier is unique.

Parameters

string $id: The id of the handler which is checked.

string $identifier: The actual get identifier configured in the exposed settings.

Return value

bool Returns whether the identifier is unique on all handlers.

Overrides DisplayPluginInterface::isIdentifierUnique

File

core/modules/views/src/Plugin/views/display/DisplayPluginBase.php, line 2570

Class

DisplayPluginBase
Base class for views display plugins.

Namespace

Drupal\views\Plugin\views\display

Code

public function isIdentifierUnique($id, $identifier) {
  foreach (ViewExecutable::getHandlerTypes() as $type => $info) {
    foreach ($this
      ->getHandlers($type) as $key => $handler) {
      if ($handler
        ->canExpose() && $handler
        ->isExposed()) {
        if ($handler
          ->isAGroup()) {
          if ($id != $key && $identifier == $handler->options['group_info']['identifier']) {
            return FALSE;
          }
        }
        else {
          if ($id != $key && isset($handler->options['expose']['identifier']) && $identifier == $handler->options['expose']['identifier']) {
            return FALSE;
          }
        }
      }
    }
  }
  return TRUE;
}