You are here

function node_field_sheet_widget in Node Field 7.2

Widget for node field sheet.

Parameters

array $node_field: Node field data.

Return value

array Form array.

1 string reference to 'node_field_sheet_widget'
node_field_sheet_node_field_info_alter in modules/node_field_sheet/node_field_sheet.module
Implements hook_node_field_info_alter().

File

modules/node_field_sheet/includes/node_field_sheet.api.inc, line 17
Api and helpers functions for node_field_sheet module.

Code

function node_field_sheet_widget(array $node_field) {
  $element_id = drupal_clean_css_identifier('sheet-edit-' . $node_field['machine_name']);
  $default = NULL;
  if (!empty($node_field['value'])) {
    $default = $node_field['value'];
  }
  $output = _sheetnode_inject('sheetfield-' . $element_id, 'sheetnode', $default, $element_id, NULL);
  $form = array(
    '#type' => 'hidden',
    '#attributes' => array(
      'id' => $element_id,
    ),
    '#prefix' => theme('form_element_label', array(
      'element' => array(
        '#title' => $node_field['title'],
        '#title_display' => 'before',
      ),
    )),
    '#suffix' => $output,
  );
  return $form;
}