function cck_select_other_widget_pre_render in CCK Select Other 7.2
Attaches Javascript during pre build because this is when array parents should be defined to take advantage of modules that alter the element structure such as field_collection.
Parameters
$element: The element array.
Return value
array The element array.
1 string reference to 'cck_select_other_widget_pre_render'
- cck_select_other_field_widget_form in ./
cck_select_other.module - Implementation of hook_field_widget_form().
File
- ./
cck_select_other.module, line 265 - Implements a select list widget that lets a user provide an alternate option.
Code
function cck_select_other_widget_pre_render($element) {
$key = $element['#field_name'] . '_' . $element['#delta'];
$settings = array(
$key => array(
'list_element' => $element['select_other_list']['#id'],
'input_element' => $element['select_other_text_input']['#id'],
),
);
$element['#attached'] = array(
'js' => array(
array(
'data' => array(
'CCKSelectOther' => $settings,
),
'type' => 'setting',
),
drupal_get_path('module', 'cck_select_other') . '/cck_select_other.js',
),
);
return $element;
}