FormElementBaseTrait.php in Flexiform 8
File
src/FormElement/FormElementBaseTrait.php
View source
<?php
namespace Drupal\flexiform\FormElement;
use Drupal\Core\Form\FormStateInterface;
trait FormElementBaseTrait {
public function settingsForm(array $form, FormStateInterface $form_state) {
$form['settings'] = [
'#type' => 'container',
];
$form['settings']['label'] = [
'#type' => 'textfield',
'#title' => $this
->t('Label'),
'#description' => $this
->t('The label that will be displayed on the form.'),
'#default_value' => !empty($this->configuration['label']) ? $this->configuration['label'] : '',
];
return $form;
}
public function settingsFormSubmit($values, array $form, FormStateInterface $form_state) {
return $values;
}
public function settingsSummary() {
return [];
}
public function formValidate(array $form, FormStateInterface $form_state) {
}
public function formSubmit(array $form, FormStateInterface $form_state) {
}
public function buildEntities(array $form, FormStateInterface $form_state) {
}
}