Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
According to the documentation, filters (and other UI elements) can supply validation callbacks to check input from the user. However, these callbacks are never called. The problem is in the following code block:
function views_edit_view_validate($form_id, $view, $form) {
... does some stuff ...
foreach (array('field', 'argument', 'sort', 'filter') as $type) {
$function = "_views_get_$type" . 's';
$info = $function();
if (is_array($view->$type)) {
foreach ($view->$type as $key => $data) {
if (!is_numeric($key)) {
continue; // some non-data data is in here.
}
$validator = $info[$data['id']]['validate'];
if (function_exists($validator)) {
$validator($data, $view, $form);
}
}
}
Everywhere else in the function, $views is an array. Changing the $view->$type to $view[$type] solves the problem and calls validators.
I suspect nothing every implemented a validator, so this problem was not exposed.
The supplied patch (against 4.7 dev) makes the appropriate changes to the above code block to change from object notation to array notation.
Comment | File | Size | Author |
---|---|---|---|
views_check_validate0.patch | 761 bytes | mfredrickson | |
Comments
Comment #1
mfredrickson CreditAttribution: mfredrickson commentedforgot to set status of patch
Comment #2
merlinofchaos CreditAttribution: merlinofchaos commentedApplied.
Comment #3
(not verified) CreditAttribution: commented