[support] D7: hook_field_extra_fields() + field_attach_form()

Georg Jaehnig georg at jaehnig.org
Fri May 25 02:09:40 UTC 2012


Hi,

I exposed a field in hook_field_extra_fields():

$form_elements['item_description'] = array(
    'label' => t('Item Description'),
    'description' => t('Item Description (an extra form field)'),
    'weight' => -5,
  );
  $extra_fields['entity_example_basic']['first_example_bundle']['form']
= $form_elements;
  return $extra_fields;

Now I thought, by calling

  field_attach_form('entity_example_basic', $entity, $form, $form_state);

in a form callback, it will be attached to $form automatically. But it doesn't.

Is there a way to change that? Or do I have to add the form field
manually in any case?

If I there's no way to attach it automatically - what is the sense in
exposing the field in
hook_field_extra_fields()?

Cheers,
-- 
Georg | http://serchilo.net - command the web


More information about the support mailing list