function sheetnode_field_widget_form in Sheetnode 7
Same name and namespace in other branches
- 7.2 sheetnode.module \sheetnode_field_widget_form()
Implements hook_field_widget_form().
File
- ./
sheetnode.module, line 857 - Module file for the sheetnode module.
Code
function sheetnode_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
$widget = $element;
$widget['#delta'] = $delta;
$defaults = isset($items[$delta]) ? $items[$delta] : array(
'name' => '',
'value' => '',
);
switch ($instance['widget']['type']) {
case 'sheetfield_spreadsheet':
$element_id = drupal_clean_css_identifier('edit-' . $element['#field_name'] . '-' . $langcode . '-' . $delta);
$output = _sheetnode_inject(drupal_clean_css_identifier('sheetfield-' . $element_id), _sheetnode_sheetfield_aliases($element['#field_name'], $instance['label'], $defaults, $delta), $defaults['value'], $element_id, isset($form['#node']) ? array(
'entity-type' => 'node',
'oid' => @$form['#node']->nid,
) : NULL);
$widget['name'] = array(
'#type' => 'textfield',
'#title' => t('Title'),
'#default_value' => @$defaults['name'],
);
$widget['value'] = array(
'#type' => 'hidden',
'#attributes' => array(
'id' => $element_id,
),
'#prefix' => $output,
);
break;
}
return $widget;
}