Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Roger broke my stuff in #574196: $type parameter not used in ctools_ajax_associate_url_to_element()! :p
if I define a form element like:
$form['job_type'] = array(
'#name' => 'datasync_scheduler_job_type',
'#title' => t('Job type'),
'#type' => 'select',
'#options' => $options,
'#description' => t('Type of job you want to add'),
'#default_value' => $defaults['job_type'],
'#attributes' => array('class' => 'ctools-use-ajax-onchange'),
);
ctools_ajax_associate_url_to_element($form, $form['job_type'], $url);
My ctools-use-ajax-onchange class gets overwritten. The attached patch fixes this behavior.
Comment | File | Size | Author |
---|---|---|---|
#3 | 652236.patch | 811 bytes | andrewlevine |
leaveMyClassPlease.patch | 860 bytes | andrewlevine | |
Comments
Comment #1
q0rban CreditAttribution: q0rban commentedWhy not:
or:
Comment #2
andrewlevine CreditAttribution: andrewlevine commentedI believe both of your examples will generate "Notice: Undefined index" if $form_element['#attributes']['class'] isn't set. Although I also think you can use !empty() safely instead of isset() && !empty() so I was being verbose
Comment #3
andrewlevine CreditAttribution: andrewlevine commentedremoving the unnecessary isset() check
Comment #4
merlinofchaos CreditAttribution: merlinofchaos commentedCommitted.