function views_handler_argument_hashtag::query in Tweet Feed 7
Build the query based upon the formula
Overrides views_handler_argument_string::query
File
- ./
tweet_feed.views.inc, line 197
Class
- views_handler_argument_hashtag
- override the string handler for handling hash tags as we need to change the query so we can look through the string with a LIKE instead of an =
Code
function query($group_by = FALSE) {
if (empty($this->options['match_exact'])) {
$argument = '%' . $this->argument . '%';
}
else {
$argument = ' ' . $this->argument . ' ';
}
$this->value = array(
$argument,
);
$this->operator = 'or';
$this
->ensure_my_table();
$formula = FALSE;
$field = "{$this->table_alias}.{$this->real_field}";
if (count($this->value) > 1) {
$operator = 'IN';
$argument = $this->value;
}
else {
if (empty($this->options['match_exact'])) {
$operator = 'LIKE';
}
else {
$operator = 'REGEXP';
}
}
$this->query
->add_where(0, $field, $argument, $operator);
}