Is it possible solved with field api this task? I need to add new elements to an existing field. For example there is a field image. I create a widget and add a checkbox
/**
* Implements hook_field_widget_form().
*/
function mymodule_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
$elements = image_field_widget_form($form, $form_state, $field, $instance, $langcode, $items, $delta, $element);
foreach (element_children($elements) as $delta) {
$elements[$delta]['#process'][] = 'custom_widget_process';
}
return $elements;
function custom_widget_process($element, &$form_state, $form) {
$element['myelement'] = array(
'#type' => 'checkbox',
'#title' => t('My checkbox.'),
);
return $element;
}
How do I save the value of the checkbox? (If I have a table for it)
Can I add additional column into an existing image field scheme? (hook_field_schema_alter - not exist)