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.
What happens:
When editing a node inside overlay Drupal.settings does not contains all settings.
Setup:
An element attaches JS settings inside hook_field_widget_form as the following
$element['ref_id'] = array('#type' => 'tableselect', '#header' => $headers,
'#options' => $options, '#default_value' => $default_value,
'#attributes' => array('id' => array('filterable-table')),
'#sticky' => TRUE,
'#attached' => array(
'js' => array(
array('data' => $jsPath . '/lib/jquery.dataTables.min.js',
'type' => 'file'),
array('data' => $jsPath . '/lib/table.filter.js',
'type' => 'file'),
array('data' => array('some_key' => array('value' => 3)),
'type' => 'setting'))));
}
NOTE:
Drupal.settings contains some_key setting, when node is not edited inside the overlay.
Comments