Commit 74128e44 authored by webchick's avatar webchick

Issue #2388941 by vijaycs85, mrjmd, abhishek-anand, dawehner, alexpott:...

Issue #2388941 by vijaycs85, mrjmd, abhishek-anand, dawehner, alexpott: Correction needed for hook_views_query_alter in views.api.php
parent cd58cb92
......@@ -459,7 +459,18 @@ public function __construct(ViewEntityInterface $storage, AccountInterface $user
}
/**
* @todo.
* Returns the identifier.
*
* @return string|null
* The entity identifier, or NULL if the object does not yet have an
* identifier.
*/
public function id() {
return $this->storage->id();
}
/**
* Saves the view.
*/
public function save() {
$this->storage->save();
......
......@@ -819,7 +819,7 @@ function hook_views_query_alter(ViewExecutable $view, QueryPluginBase $query) {
// (Example assuming a view with an exposed filter on node title.)
// If the input for the title filter is a positive integer, filter against
// node ID instead of node title.
if ($view->name == 'my_view' && is_numeric($view->exposed_raw_input['title']) && $view->exposed_raw_input['title'] > 0) {
if ($view->id() == 'my_view' && is_numeric($view->exposed_raw_input['title']) && $view->exposed_raw_input['title'] > 0) {
// Traverse through the 'where' part of the query.
foreach ($query->where as &$condition_group) {
foreach ($condition_group['conditions'] as &$condition) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment