updated simplenews from 1-beta to 2-beta, translated subscription form
This commit is contained in:
@@ -163,20 +163,12 @@ class MaterioSimplenewsSubscriptionBlock extends BlockBase implements ContainerF
|
||||
$form_object = $this->entityTypeManager->getFormObject('simplenews_subscriber', 'materio_block');
|
||||
$form_object->setUniqueId($this->configuration['unique_id']);
|
||||
$form_object->setNewsletterIds($this->configuration['newsletters']);
|
||||
$form_object->message = $this->configuration['message'];
|
||||
$form_object->message = t($this->configuration['message']);
|
||||
|
||||
// Set the entity on the form.
|
||||
if ($user = \Drupal::currentUser()) {
|
||||
if ($subscriber = simplenews_subscriber_load_by_uid($user->id())) {
|
||||
$form_object->setEntity($subscriber);
|
||||
}
|
||||
else {
|
||||
$form_object->setEntity(Subscriber::create()->fillFromAccount($user));
|
||||
}
|
||||
}
|
||||
else {
|
||||
$form_object->setEntity(Subscriber::create());
|
||||
}
|
||||
$user = \Drupal::currentUser();
|
||||
$form_object->setEntity(Subscriber::loadByUid($user->id(), 'create'));
|
||||
|
||||
|
||||
return $this->formBuilder->getForm($form_object);
|
||||
}
|
||||
|
Reference in New Issue
Block a user