function views_handler_filter_user_relationships_type::validate_type_strings in User Relationships 7
Same name and namespace in other branches
- 6 user_relationship_views/views_handler_filter_user_relationships_type.inc \views_handler_filter_user_relationships_type::validate_type_strings()
Validate the relationship type 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_user_relationships_type::validate_type_strings()
- views_handler_filter_user_relationships_type::exposed_validate in user_relationship_views/
views_handler_filter_user_relationships_type.inc - Validate the exposed handler form.
- views_handler_filter_user_relationships_type::value_validate in user_relationship_views/
views_handler_filter_user_relationships_type.inc - Validate the options form.
File
- user_relationship_views/
views_handler_filter_user_relationships_type.inc, line 76 - User Relationships Views integration. Filter handler for relationship types, with autocomplete for type names. Modeled after views_handler_filter_user_name. @author Alex Karshakevich http://drupal.org/user/183217
Class
- views_handler_filter_user_relationships_type
- @file User Relationships Views integration. Filter handler for relationship types, with autocomplete for type names. Modeled after views_handler_filter_user_name. @author Alex Karshakevich http://drupal.org/user/183217
Code
function validate_type_strings(&$form, $values) {
$rtids = array();
$names = array();
foreach ($values as $value) {
$missing[strtolower($value)] = TRUE;
$names[] = $value;
}
if (!$names) {
return $rtids;
}
foreach ($names as $name) {
if ($rtype = user_relationships_type_load(array(
'name' => $name,
))) {
unset($missing[strtolower($rtype->name)]);
$rtids[] = $rtype->rtid;
}
}
if ($missing) {
form_error($form, format_plural(count($missing), 'Unable to find relationship type: @types', 'Unable to find relationship types: @types', array(
'@types' => implode(', ', array_keys($missing)),
)));
}
return $rtids;
}