You are here

DummyForm.php in Button Field 8

File

src/Form/DummyForm.php
View source
<?php

/**
 * @file
 * Contains Drupal\button_field\Form\DummyForm.
 */
namespace Drupal\button_field\Form;

use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
class DummyForm extends FormBase {

  /**
   * {@inheritdoc}
   */
  public function getFormId() {
    return 'button_field_dummy_form';
  }

  /**
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state) {
    $element = $form_state
      ->getBuildInfo()['args'][0];
    $langcode = $element['#entity']
      ->language()
      ->getId();
    $form[$element['#field_name']][$langcode] = $element;
    return $form;
  }

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

    // TODO: This form shouldn't be submittable.
    return parent::submitForm($form, $form_state);
  }

}

Classes

Namesort descending Description
DummyForm