I want to programmatically add a view to a field group I created using the field_group
module. I created an group_articles tab field group.
When I do this something like hook_form_alter
:
$form['issues__articles'] = array(
'#type' => 'fieldgroup',
'#weight' => 0,
);
$form['issues__articles']['view'] = [
'#type' => 'view',
'#name' => 'view_admin',
'#display_id' => 'block_1',
'#weight' => 0,
];
$form['issues__articles']['#group'] = 'group_articles';
My view is added to my premade group_articles
group, inside a programmatically created fieldset
. I can change fieldgroup
in my code into details
and this would also work. But I don't want a fieldset
or details
container I want the view without a container or a simple html element like div and then inside my group_articles tab.
Changing fieldgroup
to html_element
doesn't work and removing the first part like this:
$form['issues__articles']['view'] = [
'#type' => 'view',
'#name' => 'view_admin',
'#display_id' => 'block_1',
'#weight' => 0,
];
$form['issues__articles']['#group'] = 'group_articles';
Or:
$form['issues__articles'] = [
'#type' => 'view',
'#name' => 'view_admin',
'#display_id' => 'block_1',
'#weight' => 0,
];
$form['issues__articles']['#group'] = 'group_articles';
Also doesn't work, how can I fix this?