// handlers. Note that the sort field identifier is different that other
// identifiers because it is used as a query string value of the 'sort_by'
// parameter, while the others are used as query string parameter keys.
// Therefore we can have a sort field identifier be the same as an exposed
// filter identifier. This prevents us from using
// DisplayPluginInterface::isIdentifierUnique() to test for uniqueness.
// @see \Drupal\views\Plugin\views\display\DisplayPluginInterface::isIdentifierUnique()
foreach ($this->view->display_handler->
getHandlers('sort'
) as $key =>
$handler) { if ($handler->
canExpose() &&
$handler->
isExposed()) { if ($form_state->
get('id'
) !==
$key &&
isset($handler->options
['expose'
]['field_identifier'
]) &&
$field_identifier ===
$handler->options
['expose'
]['field_identifier'
]) { $form_state->
setErrorByName('expose][field_identifier',
$this->
t('This identifier is already used by %label sort handler.',
[ '%label' =>
$handler->
adminLabel(TRUE
),
]));
return;
} } } } /**
* {@inheritdoc}
*/
public static function trustedCallbacks() {