YamlFormFlexbox.php in YAML Form 8
File
src/Plugin/YamlFormElement/YamlFormFlexbox.php
View source
<?php
namespace Drupal\yamlform\Plugin\YamlFormElement;
use Drupal\Core\Form\FormStateInterface;
class YamlFormFlexbox extends Container {
public function getDefaultProperties() {
return parent::getDefaultProperties() + [
'align_items' => 'flex-start',
];
}
protected function build($format, array &$element, $value, array $options = []) {
return $value;
}
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
$form['flexbox'] = [
'#type' => 'fieldset',
'#title' => $this
->t('Flexbox settings'),
];
$form['flexbox']['align_items'] = [
'#type' => 'select',
'#title' => $this
->t('Align items'),
'#options' => [
'flex-start' => $this
->t('Top (flex-start)'),
'flex-end' => $this
->t('Bottom (flex-end)'),
'center' => $this
->t('Center (center)'),
],
'#required' => TRUE,
];
return $form;
}
}