You are here

trait FormElementBaseTrait in Flexiform 8

Trait for basic form element things.

Because ContextAwarePluginBase is not split into traits.

Hierarchy

File

src/FormElement/FormElementBaseTrait.php, line 12

Namespace

Drupal\flexiform\FormElement
View source
trait FormElementBaseTrait {

  /**
   * {@inheritdoc}
   */
  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;
  }

  /**
   * {@inheritdoc}
   */
  public function settingsFormSubmit($values, array $form, FormStateInterface $form_state) {
    return $values;
  }

  /**
   * {@inheritdoc}
   */
  public function settingsSummary() {
    return [];
  }

  /**
   * {@inheritdoc}
   */
  public function formValidate(array $form, FormStateInterface $form_state) {
  }

  /**
   * {@inheritdoc}
   */
  public function formSubmit(array $form, FormStateInterface $form_state) {
  }

  /**
   * {@inheritdoc}
   */
  public function buildEntities(array $form, FormStateInterface $form_state) {
  }

}

Members