You are here

public function SimpleMegaMenuForm::buildForm in Simple Mega Menu 2.0.x

Same name and namespace in other branches
  1. 8 src/Form/SimpleMegaMenuForm.php \Drupal\simple_megamenu\Form\SimpleMegaMenuForm::buildForm()

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form structure.

Overrides EntityForm::buildForm

File

src/Form/SimpleMegaMenuForm.php, line 18

Class

SimpleMegaMenuForm
Form controller for Simple mega menu edit forms.

Namespace

Drupal\simple_megamenu\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {

  /* @var $entity \Drupal\simple_megamenu\Entity\SimpleMegaMenu */
  $form = parent::buildForm($form, $form_state);
  if (!$this->entity
    ->isNew()) {
    $form['new_revision'] = [
      '#type' => 'checkbox',
      '#title' => $this
        ->t('Create new revision'),
      '#default_value' => FALSE,
      '#weight' => 10,
    ];
  }
  return $form;
}