Created
February 16, 2017 18:48
-
-
Save szeidler/f2cd3432607f5b23971334f20e7827ed to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_views_query_alter(). | |
*/ | |
function ramsalt_shy_replacement_views_query_alter(&$view, &$query) { | |
if ($view->name === 'frontpage_admin') { | |
foreach ($query->where[1]['conditions'] as $delta => $condition) { | |
if ($condition['field'] === 'node.title') { | |
$query->add_where_expression(1, "REPLACE(node.title, '=', '') " . $condition['operator'] . " '" . $condition['value'] . "'"); | |
unset($query->where[1]['conditions'][$delta]); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Side-effect. It's a simple REPLACE(), not the more complex pattern we're using in PHP:
/([a-z]+)=([a-z]+)/i