You are here

function taxonomy_get_terms_by_name_match_regex in Slickgrid 7.2

Similar to taxonomy_get_terms_by_name_match(), but with regex search

1 call to taxonomy_get_terms_by_name_match_regex()
slickgrid_get_data in includes/slickgrid.getdata.inc
Return the data for a dynamically loaded SlickGrid.

File

includes/slickgrid.getdata.inc, line 297

Code

function taxonomy_get_terms_by_name_match_regex($name) {
  $name = db_like(trim($name));
  $query = db_select('taxonomy_term_data', 't')
    ->fields('t', array(
    'tid',
  ))
    ->condition('name', $name, 'RLIKE');
  if (isset($vocabulary)) {
    $vocabulary = taxonomy_vocabulary_machine_name_load($vocabulary);
    $query
      ->condition('vid', $vocabulary->vid);
  }
  $tids = $query
    ->execute()
    ->fetchCol();
  if (count($tids)) {
    return taxonomy_term_load_multiple($tids);
  }
  else {
    return array(
      PHP_INT_MAX => PHP_INT_MAX,
    );
  }
}