Does your Drupal views combine filter appears to be case sensitive?

Standaard

It seems to be an issue with MySQL wich is possible to ignore by adding the following code. Just create a module and add a hook_views_query_alter in your module:

function yourmodulename_views_query_alter(&$view, &$query) {
  // Find all combine fields and make them case insensitive.
  foreach ($query->where as $group_key => $group) {
    foreach ($group['conditions'] as $key => $condition) {

          if (is_string($condition[‘field’]) && (preg_match(‘/:views_combine/’, $condition[‘field’]))) {

            $query->where[$group_key][‘conditions’][$key][‘field’] = $condition[‘field’] . ‘ COLLATE utf8_general_ci’;
        }
    }
  }
}

More info can be found on:

https://drupal.org/comment/7998079#comment-7998079

Advertenties

Geef een reactie

Vul je gegevens in of klik op een icoon om in te loggen.

WordPress.com logo

Je reageert onder je WordPress.com account. Log uit / Bijwerken )

Twitter-afbeelding

Je reageert onder je Twitter account. Log uit / Bijwerken )

Facebook foto

Je reageert onder je Facebook account. Log uit / Bijwerken )

Google+ photo

Je reageert onder je Google+ account. Log uit / Bijwerken )

Verbinden met %s