function _user_reference_view_settings_validate in References 7.2
Validate callback for the 'view settings' fieldset.
Puts back the various form values in the expected shape.
1 string reference to '_user_reference_view_settings_validate'
- user_reference_field_settings_form in user_reference/
user_reference.module - Implements hook_field_settings_form().
File
- user_reference/
user_reference.module, line 146 - Defines a field type for referencing a user from a node.
Code
function _user_reference_view_settings_validate($element, &$form_state, $form) {
// Split view name and display name from the 'view_and_display' value.
if (!empty($element['view_and_display']['#value'])) {
list($view, $display) = explode(':', $element['view_and_display']['#value']);
}
else {
$view = '';
$display = '';
}
// Explode the 'args' string into an actual array. Beware, explode() turns an
// empty string into an array with one empty string. We'll need an empty array
// instead.
$args_string = trim($element['args']['#value']);
$args = $args_string === '' ? array() : array_map('trim', explode(',', $args_string));
$value = array(
'view_name' => $view,
'display_name' => $display,
'args' => $args,
);
form_set_value($element, $value, $form_state);
}