You are here

public function OgMenuForm::form in Organic Groups Menu (OG Menu) 8

Gets the actual form array to be built.

Overrides EntityForm::form

See also

\Drupal\Core\Entity\EntityForm::processForm()

\Drupal\Core\Entity\EntityForm::afterBuild()

File

src/Form/OgMenuForm.php, line 15

Class

OgMenuForm
Class OgMenuForm.

Namespace

Drupal\og_menu\Form

Code

public function form(array $form, FormStateInterface $form_state) {
  $form = parent::form($form, $form_state);
  $ogmenu = $this->entity;
  $form['label'] = array(
    '#type' => 'textfield',
    '#title' => $this
      ->t('Label'),
    '#maxlength' => 255,
    '#default_value' => $ogmenu
      ->label(),
    '#description' => $this
      ->t("Label for the OG Menu."),
    '#required' => TRUE,
  );
  $form['id'] = array(
    '#type' => 'machine_name',
    '#default_value' => $ogmenu
      ->id(),
    '#machine_name' => array(
      'exists' => '\\Drupal\\og_menu\\Entity\\OgMenu::load',
    ),
    '#disabled' => !$ogmenu
      ->isNew(),
  );

  /* You will need additional form elements for your custom properties. */
  return $form;
}