function cck_table_field_widget_form in CCK Table Field 8
Same name and namespace in other branches
- 7 cck_table.module \cck_table_field_widget_form()
Implements hook_field_widget_form().
File
- ./
cck_table.module, line 166 - Defines a field type that outputs data in a table.
Code
function cck_table_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $base) {
// it suggest I use += to avoid overwriting incoming $element & $element as parameter instead of $base
// if I do this it throws error of undefined operand type
// if I do this then I cannot put in default help
if (!empty($instance['description'])) {
$description = t($instance['description']);
}
else {
$description = t(_cck_table_default_help_text($instance['display']['default']['type']));
}
$element = $base;
$element['table'] = array(
'#type' => 'textarea',
'#default_value' => isset($items[$delta]['table']) ? $items[$delta]['table'] : NULL,
'#rows' => $instance['widget']['settings']['rows'],
'#description' => $description,
);
return $element;
}