You are here

function fape_field_edit_field_form in Field API Pane Editor (FAPE) 7

Subform to edit a field instance.

This isn't a true form. As such it modifies the $form by reference.

1 string reference to 'fape_field_edit_field_form'
fape_field_edit_page in ./fape.module
Page callback to edit an entity field.

File

./fape.module, line 194
Adds direct field editing via contextual links.

Code

function fape_field_edit_field_form(&$form, &$form_state) {
  $form['#parents'] = array();
  $entity_type = $form_state['entity_type'];
  $entity = $form_state['entity'];
  $field_name = $form_state['field_name'];
  $field_instance = $form_state['field_instance'];
  $langcode = $form_state['langcode'];
  $bundle = $form_state['bundle'];
  ctools_include('fields');

  // If no language is provided use the default site language.
  $options = array(
    'language' => field_valid_language($langcode),
    'default' => TRUE,
  );
  $form += (array) ctools_field_invoke_field($field_instance, 'form', $entity_type, $entity, $form, $form_state, $options);
  $form['#pre_render'][] = '_field_extra_fields_pre_render';
  $form['#entity_type'] = $entity_type;
  $form['#bundle'] = $bundle;

  // Let other modules make changes to the form.
  // Exclude some modules.
  $excluded_modules = array(
    'field_group',
    'metatag',
    'panelizer',
    'redirect',
  );

  // Avoid module_invoke_all() to let parameters be taken by reference.
  foreach (module_implements('field_attach_form') as $module) {
    if (in_array($module, $excluded_modules)) {
      continue;
    }
    $function = $module . '_field_attach_form';
    $function($entity_type, $entity, $form, $form_state, $langcode);
  }
  $form['#validate'][] = 'fape_field_edit_field_form_validate';
  $form['#submit'][] = 'fape_field_edit_field_form_submit';
}