I'm in the middle of writing an access plugin using the ctools taxonomy term plugin as an example. From plugins/access/term.inc:
$plugin = array(
'title' => t("Taxonomy: term"),
'description' => t('Control access by a specific term.'),
'callback' => 'ctools_term_ctools_access_check',
'default' => array('vids' => array()),
'settings form' => 'ctools_term_ctools_access_settings',
'settings form validation' => 'ctools_term_ctools_access_settings_validate',
'settings form submit' => 'ctools_term_ctools_access_settings_submit',
'summary' => 'ctools_term_ctools_access_summary',
'required context' => new ctools_context_required(t('Term'), array('taxonomy_term', 'terms')),
);
While trying to figure out why my validation callback was never being called, I searched for 'settings form validation' in the ctools module, only to find it only exists in two other places, the term_parent and term_depth plugins. From includes/context-access-admin.inc:
/**
* Validate handler for argument settings.
*/
function ctools_access_ajax_edit_item_validate($form, &$form_state) {
if ($function = ctools_plugin_get_function($form_state['plugin'], 'settings form validate')) {
$function($form, $form_state);
}
}
It appears based on the above that the array key for these callbacks should be 'settings form validate', not 'settings form validation'.
None of these three plugins actually implement the callback they declare, so this error isn't actually causing any validation code not to run in these three plugins.
Attached patch changes the key for the validate callback to 'settings form validate' for all three plugins.
Comment | File | Size | Author |
---|---|---|---|
#2 | ctools-validation_callback_key-3049993-2-D7.patch | 2.34 KB | ajm8372 |
Comments
Comment #2
ajm8372 CreditAttribution: ajm8372 commentedComment #3
joelpittetThanks @ajm8372, that's a good catch. I've committed it to the dev branch for the next release.
Comment #6
Chris Matthews CreditAttribution: Chris Matthews as a volunteer commented