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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ajm8372 created an issue. See original summary.

ajm8372’s picture

Status: Active » Needs review
FileSize
2.34 KB
joelpittet’s picture

Status: Needs review » Fixed

Thanks @ajm8372, that's a good catch. I've committed it to the dev branch for the next release.

  • joelpittet committed 852e8d0 on 7.x-1.x authored by ajm8372
    Issue #3049993 by ajm8372: Access plugin validation callback in term,...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

Chris Matthews’s picture