public function SubscriptionsPageForm::buildForm in Simplenews 3.x
Same name and namespace in other branches
- 8.2 src/Form/SubscriptionsPageForm.php \Drupal\simplenews\Form\SubscriptionsPageForm::buildForm()
- 8 src/Form/SubscriptionsPageForm.php \Drupal\simplenews\Form\SubscriptionsPageForm::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/ SubscriptionsPageForm.php, line 17
Class
- SubscriptionsPageForm
- Configure subscriptions of the currently authenticated subscriber.
Namespace
Drupal\simplenews\FormCode
public function buildForm(array $form, FormStateInterface $form_state, $snid = NULL, $timestamp = NULL, $hash = NULL) {
// Try to load the corresponding subscriber.
$subscriber = Subscriber::load($snid);
if ($subscriber && $hash == simplenews_generate_hash($subscriber
->getMail(), 'manage', $timestamp)) {
$this
->setEntity($subscriber);
}
else {
throw new NotFoundHttpException();
}
return parent::buildForm($form, $form_state);
}