private function LayouterForm::buildLayouterFields in Layouter - WYSIWYG layout templates 8
Sets up and builds fields from selected layouter template.
Parameters
array $form: The form array.
\Drupal\Core\Form\FormStateInterface $form_state: Form state.
1 call to LayouterForm::buildLayouterFields()
- LayouterForm::buildForm in src/
Form/ LayouterForm.php - Form constructor.
File
- src/
Form/ LayouterForm.php, line 381
Class
- LayouterForm
- Provides multistep ajax form for an layout choice.
Namespace
Drupal\layouter\FormCode
private function buildLayouterFields(array &$form, FormStateInterface $form_state) {
$type = $form_state
->get('type');
$fields = $this->templates[$type]['fields'];
if (!is_null($fields)) {
$form_state
->set('fields', $fields);
$form['data'] = [];
foreach ($fields as $name => $params) {
$params['description'] = isset($params['description']) ? $params['description'] : '';
if ($params['type'] == 'image') {
$params['title'] = isset($params['title']) ? $params['title'] : $this
->t('Image settings');
$form['data'] += $this
->imageContentHandler($name, $params);
}
if ($params['type'] == 'text') {
$params['title'] = isset($params['title']) ? $params['title'] : $this
->t('Text');
$form['data'] += $this
->textContentHandler($name, $params);
}
}
}
}