You are here

function _multifield_field_attach_form in Multifield 7

Same name and namespace in other branches
  1. 7.2 multifield.field.inc \_multifield_field_attach_form()
1 call to _multifield_field_attach_form()
multifield_field_widget_form in ./multifield.field.inc
Implements hook_field_widget_form().

File

./multifield.field.inc, line 645
Field integration for the Multifield module.

Code

function _multifield_field_attach_form($entity_type, $entity, &$form, &$form_state, $langcode = NULL, $options = array()) {

  // Validate $options since this is a new parameter added after Drupal 7 was
  // released.

  //$options = is_array($options) ? $options : array();

  // Set #parents to 'top-level' by default.

  //$form += array('#parents' => array());

  // If no language is provided use the default site language.

  //$options['language'] = field_valid_language($langcode);

  //$form += (array) _field_invoke_default('form', $entity_type, $entity, $form, $form_state, $options);

  // Add custom weight handling.
  list($id, $vid, $bundle) = entity_extract_ids($entity_type, $entity);
  $form['#pre_render'][] = '_field_extra_fields_pre_render';
  $form['#entity_type'] = $entity_type;
  $form['#entity'] = $entity;
  $form['#bundle'] = $bundle;

  // Let other modules make changes to the form.
  // Avoid module_invoke_all() to let parameters be taken by reference.
  foreach (module_implements('field_attach_form') as $module) {
    $function = $module . '_field_attach_form';
    $function($entity_type, $entity, $form, $form_state, $langcode);
  }
}