You are here

function _editablefields_content_form_field in Editable Fields 5.2

Same name and namespace in other branches
  1. 5.3 editablefields.module \_editablefields_content_form_field()
  2. 5 editablefields.module \_editablefields_content_form_field()
1 call to _editablefields_content_form_field()
theme_views_editablefields_handle_field in ./editablefields.module
Themeable function to handle displaying a specific field.

File

./editablefields.module, line 153

Code

function _editablefields_content_form_field(&$node, $fieldname) {
  $form = array();
  $type_name = is_string($node) ? $node : (is_array($node) ? $node['type'] : $node->type);
  $types = content_types($type_name);
  $field = $types['fields'][$fieldname];
  $widget_types = _content_widget_types();

  // Set form parameters so we can accept file uploads.
  if (count($type['fields'])) {
    $form['#attributes'] = array(
      "enctype" => "multipart/form-data",
    );
  }
  _editablefields_content_widget_invoke_field('prepare form values', $node, $field, $widget_types);
  $form = array_merge($form, _editablefields_content_widget_invoke_field('form', $node, $field, $widget_types));
  return $form;
}