You are here

public function WishlistShareForm::form in Commerce Wishlist 8.3

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/WishlistShareForm.php, line 51

Class

WishlistShareForm
Provides the wishlist share form.

Namespace

Drupal\commerce_wishlist\Form

Code

public function form(array $form, FormStateInterface $form_state) {
  $form['#tree'] = TRUE;
  $form['#attached']['library'][] = 'core/drupal.dialog.ajax';

  // Workaround for core bug #2897377.
  $form['#id'] = Html::getId($form_state
    ->getBuildInfo()['form_id']);
  $form['to'] = [
    '#type' => 'email',
    '#title' => $this
      ->t('Recipient'),
    '#required' => TRUE,
  ];
  return $form;
}