You are here

public function DisplayPluginBase::isIdentifierUnique in Views (for Drupal 7) 8.3

Check 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.

File

lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php, line 2622
Definition of Drupal\views\Plugin\views\display\DisplayPluginBase.

Class

DisplayPluginBase
The default display plugin handler. Display plugins handle options and basic mechanisms for different output methods.

Namespace

Drupal\views\Plugin\views\display

Code

public function isIdentifierUnique($id, $identifier) {
  foreach (ViewExecutable::viewsHandlerTypes() 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 && $identifier == $handler->options['expose']['identifier']) {
            return FALSE;
          }
        }
      }
    }
  }
  return TRUE;
}