For example, I've got Location module, which alters node edit form and adds a new "locations" element with "#type" = "fieldset". I wonder If I can alter node edit form (or try other hook) so it will move Location's module form edit fieldset content to the existing horisontal tab which was created using Field UI earlier.
Also it would be good if I could move the whole "additional_settings" fieldset to the other horizontal tab.
I've tried to add elements to #groups array and set parent for fieldset, but there is no effect.
Thank you.

Comments

nils.destoop’s picture

You can move your field to a group by adding it to the #group_children array with a form_alter.

Example:

  $form['myfield'] = array(
    '#type' => 'textfield',
    '#title' => t('My field'),
  );

  $form['#group_children']['myfield'] = 'group_section1';
Stalski’s picture

@zuuperman & all:
We should somehow be able to detect those form altering. Maybe:
- run the function on front end , do a check by taking a diff with original and after form alter somehow.
- Stash all those customly added html-wrappers (may not be fieldsets alone, but also a div with a prefix and suffix)
- Provide them in the field UI screens
- Take all field groups and "know" which ones need to be handled by ? callback, default function?

Bad idea?

- Edit: @ Julia Trushina : does the solution provide by zuuperman fix your case?

Stalski’s picture

Title: Is it possible to move other module's custom fieldset to the horisontal tab's content at node edit form? » Meke other / custom fieldsets available in the FIELD UI fields and display screens.

Changing title to have a concept. It would be very nice to have a generic system for all those who do things a bit different.

swentel’s picture

In DS there' the possibility to define extra fields through the user interface. We could do this as well for field_group which already predefines some popular modules.

Mind if I create a patch for this ? It will introduce a settings screen like in DS, but hey, it's all for the benefit of everybody :)

swentel’s picture

Title: Meke other / custom fieldsets available in the FIELD UI fields and display screens. » Make other / custom fieldsets available in the FIELD UI fields and display screens.

typo in title

Stalski’s picture

Assigned: Unassigned » swentel

Assigning to Swentel who is currently investigating this rather difficult problem.

Stalski’s picture

I can add here that #fieldgroups property is leading to let field_group know it can (pre_)render the element(s).

swentel’s picture

Marking this a dupe of #1280974: Allow to show custom in code declared elements as field_group in the UI - we have some proof of concept working already, more to come later.

swentel’s picture

Status: Active » Closed (duplicate)