You are here

function editablefields_cck_form in Editable Fields 6.3

EDITABLE Form API form function for field_edit_form. Returns a form api definition for editing fields.

File

plugins/editables/cck.inc, line 32

Code

function editablefields_cck_form(&$form_state) {
  $form = array();
  $params = empty($form_state['_params']) ? array() : $form_state['_params'];
  module_load_include('inc', 'content', 'includes/content.node_form');
  $form['#node'] = $form_state['node'];
  $node = $form_state['node'];
  $nids = array(
    $node->nid,
  );
  $field = content_fields($params['field_name'], $params['node_type']);
  $css_class = 'form-' . str_replace('_', '-', $params['field_name']);
  $form['#attributes'] = array(
    'class' => $css_class,
  );
  $form['#field_info'][$params['field_name']] = $field;
  $form += (array) content_field_form($form, $form_state, $field);
  $form[$params['field_name']]['#weight'] = 0;
  $form['nids'] = array(
    '#type' => 'hidden',
    '#default_value' => implode(',', $nids),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Submit'),
    '#weight' => 20,
  );
  return $form;
}