Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
On line 268 of webform_conditional.module foreach ($javascript['settings']['data'] as $delta => $settings) {
causes a PHP 'Undifined index: settings' warning if no javascript has been previously added with drupal_add_js. (I am using this in the install profile, that is why no js has been added yet).
I was able to fix this by adding a check to the existence of $javascript['settings']['data']
in webform_conditional_add_js:
function webform_conditional_add_js(&$form, $form_state) {
// If the form is being rebuilt we need to reset the previous settings,
// otherwise array_merge_recursive() will turn string values into arrays.
$javascript = &drupal_static('drupal_add_js', array());
if (isset($javascript['settings']['data'])) {
foreach ($javascript['settings']['data'] as $delta => $settings) {
if (key($settings) == 'webform_conditional') {
unset($javascript['settings']['data'][$delta]);
break;
}
}
}
drupal_add_js($form['#webform_conditional_js'], array('type' => "setting", 'scope' => JS_DEFAULT));
drupal_add_js(drupal_get_path('module', 'webform_conditional') . '/webform_conditional.js');
return $form;
}