Все добра!
Подскажите пожалуйста как обернуть программно стилем несколько полей в форме, либо вставить fieldset в коде php?
Например обернуть в один див 2 поля , 2-е и 3-е
$form['form1'] = [
'#id' => 'form1',
'#placeholder' => '...',
'#title' => $this->t(''),
'#type' => 'textfield',
];
$form['form2'] = [
'#id' => 'form2',
'#placeholder' => '...',
'#type' => 'textfield',
'#title' => $this->t(''),
];
$form['form3'] = [
'#id' => 'form3',
'#placeholder' => '...',
'#type' => 'textfield',
'#title' => $this->t(''),
];
$form['form4'] = [
'#id' => 'form4',
'#placeholder' => '...',
'#type' => 'textfield',
'#title' => $this->t(''),
];
'#id' => 'form1',
'#placeholder' => '...',
'#title' => $this->t(''),
'#type' => 'textfield',
];
$form['form2'] = [
'#id' => 'form2',
'#placeholder' => '...',
'#type' => 'textfield',
'#title' => $this->t(''),
];
$form['form3'] = [
'#id' => 'form3',
'#placeholder' => '...',
'#type' => 'textfield',
'#title' => $this->t(''),
];
$form['form4'] = [
'#id' => 'form4',
'#placeholder' => '...',
'#type' => 'textfield',
'#title' => $this->t(''),
];
Комментарии
используйте '#type' => container или '#type' => html_tag
ну и примеры ...
из ядра, контриба или как вам уже советовали модуля examples
https://git.drupalcode.org/project/examples/-/blob/3.x/modules/form_api_...
уже решила, благодарю
'#type' => 'fieldset',
'#title' => $this
->t('Author'),
);
$form['author']['name'] = array(
'#type' => 'textfield',
'#title' => $this
->t('Name'),
);