0

I created a ctools access plugin for use with visibility rules in panels. When I click to add the rule, my rule "Site Installation Profile" shows in the list. I click it and click continue and my form for input of the profile name shows. I enter the name and click save only to get an AJAX error message that says the service is unavailable. If I cancel and try to edit the content of the panel, I get an error page. The error page simply says "Error" with no stack trace information. I've put in break points in my access plugin to try to debug with xdebug but it's not catching anywhere where the error is occurring and I'm not sure where to look. Here is the plugin:

$plugin = array(
  'title' => t('Site Installation Profile'),
  'description' => t('Installation profile value check'),
  'callback' => 'llnl_form_alterations_site_profile_ctools_access_check',
  'default' => array(
    'profile' => '',
    'negate' => 0,
  ),
  'settings form' => 'llnl_form_alterations_site_profile_ctools_access_settings',
  'summary' => 'llnl_form_alterations_site_profile_ctools_access_summary',
  'all contexts' => TRUE,
);

/**
 * Actual access check.
 */
function llnl_form_alterations_site_profile_ctools_access_check($conf, $context) {
  $profile_ck = $conf['profile'];
  $profile = drupal_get_profile();
  if ($profile == $profile_ck) {
    return TRUE;
  }
  else {
    return FALSE;
  }
}

/**
 * Provide a config form.
 */
function llnl_form_alterations_site_profile_ctools_access_settings($form, &$form_state, $conf) {
  $form['settings']['profile'] = array(
    '#type' => 'textfield',
    '#title' => t('Installation Profile'),
    '#default_value' => $conf['profile'],
    '#required' => TRUE,
  );
  return $form;
}

/**
 * Provide a summary description.
 */
function llnl_form_alterations_site_profile_ctools_access_summary($conf, $context) {
  $profile = $conf['profile'];
  return t('Show if "@profile" is site installation profile', $profile);
}
0

I found it within a few minutes of posting this question. The issue was in my summary function and my use of placeholder values. Once that was fixed, it was working fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.