I wrote a custom module that adds a widget. This widget consists of multiple textfields and an ajax button that sends that information to an external service and gets in return and identifier that is stored locally.
However, it is not possible to render this widget within a group. (Using the field group module) When adding it to a content type it will never be rendered within a group (as a fieldset, a tab, div or whatever), but instead before or after it.
My custom fields within the widget are bundled together by:
$form['fieldset']['field_name1']
$form['fieldset']['field_name2']
But even when they are not put together as a fieldset, it doesn't work.
How come?
Here is a code snipped of the definition of the fieldset:
$form['b2share_fieldset'] = array(
'#type' => 'fieldset',
'#title' => t('Publish data on B2Share'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#tree' => TRUE,
);
$form['b2share_fieldset']['database_field_name'] = array(
'#type' => 'hidden',
'#default_value' => $b2share_fieldname,
);
The complete module can be found here.
I want to emphasize that my widget works fine. It's just always displayed outside the fieldgroup even when it is placed within the fieldgroup. Declaring it as a container as described here doesn't work either.
I also tried the patch provided here, but without success.
Also when I remove the fieldgroup and just leave the fields in there, they are always rendered outside the parent element.There aren't any status or error messages either.
I actually want to publish this as a contributed module, so I'd appreciate any help as I want to get rid of this bug, before I do that.
The problem is also described here.