1 redirect.admin.inc redirect_build_filter_query(SelectQueryInterface $query, array $fields, $keys = '')

Extends a query object for URL redirect filters.


QueryAlterableInterface $query: Query object that should be filtered.

array $fields: The fields within the query that should be checked for the $keys value.

string $keys: The filter string on which asterisks should be replaced with


core/modules/redirect/redirect.admin.inc, line 217
Admin page callbacks for the Redirect module.


function redirect_build_filter_query(SelectQueryInterface $query, array $fields, $keys = '') {
  if ($keys && $fields) {
    // Replace wildcards with PDO wildcards.
    $conditions = db_or();
    $wildcard = '%' . trim(preg_replace('!\*+!', '%', db_like($keys)), '%') . '%';
    foreach ($fields as $field) {
      $conditions->condition($field, $wildcard, 'LIKE');