notifications_views_handler_argument_autocomplete.inc in Notifications 7
File
notifications_views/includes/notifications_views_handler_argument_autocomplete.inc
View source
<?php
class notifications_views_handler_argument_autocomplete extends views_handler_argument {
function query() {
$this
->ensure_my_table();
$this->query
->add_where(0, "{$this->table_alias}.{$this->real_field} LIKE '%s%%'", $this->argument);
}
function default_actions($which = NULL) {
$defaults = array(
'ignore' => array(
'title' => t('Display all values'),
'method' => 'default_ignore',
'breadcrumb' => TRUE,
),
'not found' => array(
'title' => t('Hide view / Page not found (404)'),
'method' => 'default_not_found',
'hard fail' => TRUE,
),
'empty' => array(
'title' => t('Display empty text'),
'method' => 'default_empty',
'breadcrumb' => TRUE,
),
'default' => array(
'title' => t('Provide default argument'),
'method' => 'default_default',
'form method' => 'default_argument_form',
'has default argument' => TRUE,
'default only' => TRUE,
),
);
if ($which) {
if (!empty($defaults[$which])) {
return $defaults[$which];
}
}
else {
return $defaults;
}
}
function option_definition() {
$options = parent::option_definition();
$options['wildcard'] = array(
'default' => '*',
);
}
}