Drupal Version 8.4.2 on the latest dev branch of simplenews.
I am seeing that the Subscriber Entity's form handler definitions are not correctly being applied.
Subscriber.php has following annotations.
* handlers = {
* "storage" = "Drupal\simplenews\Subscription\SubscriptionStorage",
* "form" = {
* "default" = "Drupal\simplenews\Form\SubscriberForm",
* "account" = "Drupal\simplenews\Form\SubscriptionsAccountForm",
* "block" = "Drupal\simplenews\Form\SubscriptionsBlockForm",
* "page" = "Drupal\simplenews\Form\SubscriptionsPageForm",
* "delete" = "Drupal\simplenews\Form\SubscriberDeleteForm",
* },
However, when the entity is being called, the defined form handlers are as follows.

As a result, all pages and blocks where the forms are build using entityTypeManager->getFormObject('simplenews_subscriber', /*$form_operation e.g. 'block'*/) is not working.
This includes,
- Subscription Block, which is why this issue is actually occuring.
| Comment | File | Size | Author |
|---|---|---|---|
| simplenews-form-handlers.png | 50.7 KB | jonnyeom |
Comments
Comment #2
jonnyeom commentedIs nobody else getting this error?
I don't think i am using the module incorrectly.
Appreciate the feedback.
Comment #3
berdirNope, definitely not happen for me, and we have lots of tests that are working fine.
The only explanation I have a is an entity type alter hook doing something strange. Any other modules installed that do anything with form modes? They might mess things up.
Comment #4
bmunslow commentedI'm experiencing the same issue in Drupal 8.5.1, simplenews release 8.x-1.0-alpha3
Adding Simplenews Subscription block to any visible region throws error:
The only module in my installation, that I can think of, which tampers with form modes is
form_mode_managerI will try to uninstall it and see if it makes any difference.
Comment #5
bmunslow commentedHi,
I can confirm that, in my case, module
form_mode_manager (8.x-2.0-beta1)was the culprit and caused this fatal error when simplenews subscription block was enabled.I was able to trace this thanks to @Berdir's previous comment #3.
I searched my module base and got a list of all the modules which implemented
hook_entity_type_alter(), which were just a few, and then analyzed the code in each of them.I got to see very quickly that module
form_mode_manageruses this hook to alter the entity handlers for each form mode in each entity type, which results in the corrupted form handlers being set as described by the reporter of this issue, @jonnyeom.@see: /modules/form_mode_manager/src/EntityTypeInfo.php @@ -74,7Tracing down this method shows how Form Classes are being altered. If you comment the following line in
form_mode_manager, the error disappears and subscription block is shown properly:What I don't really knowis what the right way of fixing this issue is... perhaps we should simply file the issue in the
form_mode_managermodule issue queue?Comment #6
bmunslow commentedAs it turns out, an issue was already in the queue of form_mode_manager module reporting conflict with simplenews.
Cross-referenced this issue.
Comment #7
berdirThanks, closing as duplicate of that, needs to be fixed there.