function views_handler_filter_tag_font_tid::validate_tag_strings in @font-your-face 6.2
Same name and namespace in other branches
- 7.2 modules/fontyourface_ui/views/views_handler_filter_tag_font_tid.inc \views_handler_filter_tag_font_tid::validate_tag_strings()
- 7 views/views_handler_filter_tag_font_tid.inc \views_handler_filter_tag_font_tid::validate_tag_strings()
Validate the user string. Since this can come from either the form or the exposed filter, this is abstracted out a bit so it can handle the multiple input sources.
2 calls to views_handler_filter_tag_font_tid::validate_tag_strings()
File
- views/
views_handler_filter_tag_font_tid.inc, line 211 - Views handler.
Class
- views_handler_filter_tag_font_tid
- Filter by tag id. Largely copied from views_handler_filter_term_node_tid.inc
Code
function validate_tag_strings(&$form, $values) {
if (empty($values)) {
return array();
}
// if
$tids = array();
$placeholders = array();
$args = array();
$results = array();
foreach ($values as $value) {
$missing[strtolower($value)] = TRUE;
$args[] = $value;
$placeholders[] = "'%s'";
}
// foreach
if (!$args) {
return;
}
// if
$result = db_query("SELECT * FROM {fontyourface_tag} WHERE name IN (" . implode(', ', $placeholders) . ")", $args);
while ($tag = db_fetch_object($result)) {
unset($missing[strtolower($tag->name)]);
$tids[] = $tag->tid;
}
// while
if ($missing) {
form_error($form, format_plural(count($missing), 'Unable to find tag: @tags', 'Unable to find tags: @tags', array(
'@tags' => implode(', ', array_keys($missing)),
)));
}
// if
return $tids;
}