You are here

public function SharerichForm::form in Sharerich 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/SharerichForm.php, line 24
Contains \Drupal\sharerich\Form\SharerichForm.

Class

SharerichForm
Class SharerichForm.

Namespace

Drupal\sharerich\Form

Code

public function form(array $form, FormStateInterface $form_state) {
  $form = parent::form($form, $form_state);
  $sharerich_set = $this->entity;
  $form['label'] = array(
    '#type' => 'textfield',
    '#title' => $this
      ->t('Name'),
    '#maxlength' => 255,
    '#default_value' => $sharerich_set
      ->label(),
    '#description' => $this
      ->t("Name for the Sharerich set."),
    '#required' => TRUE,
  );
  $form['id'] = array(
    '#type' => 'machine_name',
    '#default_value' => $sharerich_set
      ->id(),
    '#machine_name' => array(
      'exists' => '\\Drupal\\sharerich\\Entity\\Sharerich::load',
    ),
    '#disabled' => !$sharerich_set
      ->isNew(),
  );
  $form['services'] = $this
    ->buildOverviewForm();
  return $form;
}