- Issue created by @b.lu
- 🇩🇪Germany jurgenhaas Gottmadingen
There should be a php error message in the logs. Or you could enable error messages on screen. We need the stack trace to see what, why and where it fails.
There are two log messages that are produced as a result of this model.
First:
Message Error: Call to a member function access() on null in Drupal\webform\Plugin\Action\WebformEntityCloseAction->access() (line 33 of /modules/webform/src/Plugin/Action/WebformEntityCloseAction.php).
Severity: Error
------------------------------------------------------------------------------------------------------------------------------
Second:
Deprecated function: Creation of dynamic property Drupal\webform\WebformTokenManager::$config is deprecated in Drupal\webform\WebformTokenManager->__construct() (line 108 of /modules/webform/src/WebformTokenManager.php)
#0 /core/includes/bootstrap.inc(158): _drupal_error_handler_real(8192, 'Creation of dyn...', '/home4/...', 108)
#1 /modules/webform/src/WebformTokenManager.php(108): _drupal_error_handler(8192, 'Creation of dyn...', '/home4/...', 108)
#2 /core/lib/Drupal/Component/DependencyInjection/Container.php(259): Drupal\webform\WebformTokenManager->__construct(Object(Drupal\Core\Session\AccountProxy), Object(Drupal\Core\Language\LanguageManager), Object(Drupal\Core\Config\ConfigFactory), Object(Drupal\Core\Extension\ModuleHandler), Object(Drupal\eca\Token\ContribToken))
#3 /core/lib/Drupal/Component/DependencyInjection/Container.php(177): Drupal\Component\DependencyInjection\Container->createService(Array, 'webform.token_m...')
#4 /core/lib/Drupal/Component/DependencyInjection/Container.php(434): Drupal\Component\DependencyInjection\Container->get('webform.token_m...', 1)
#5 /core/lib/Drupal/Component/DependencyInjection/Container.php(237): Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Array)
#6 /core/lib/Drupal/Component/DependencyInjection/Container.php(177): Drupal\Component\DependencyInjection\Container->createService(Array, 'webform.excepti...')
#7 /core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(105): Drupal\Component\DependencyInjection\Container->get('webform.excepti...')
#8 /vendor/symfony/http-kernel/HttpKernel.php(221): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object(Symfony\Component\HttpKernel\Event\ExceptionEvent), 'kernel.exceptio...')
#9 /vendor/symfony/http-kernel/HttpKernel.php(89): Symfony\Component\HttpKernel\HttpKernel->handleThrowable(Object(Error), Object(Symfony\Component\HttpFoundation\Request), 1)
#10 /core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#11 /core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#12 /core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#13 /core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#14 /core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#15 /core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#16 /core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#17 /core/lib/Drupal/Core/DrupalKernel.php(686): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#18 /index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#19 {main}Severity: Debug
- 🇩🇪Germany jurgenhaas Gottmadingen
The action in your model to close the webform doesn't know which webform should be deleted. You're providing the token named
webform
as the entity, but that token doesn't exist. You need to insert an action to load that config entity into that token first, so that the action knows, which webform to close. Thank you for your feedback, Jurgen.
I'm attempting to close all webforms created by a user, which in this application a webform is a field within a content that a user has created - so in short, in the event of a user making a change to a field of their profile, then all webforms of any content (of a specific content type) created by that user will preferably close, but disabling the submit button would also be acceptable, and not unpublish the content that the webform is a field of.
- 🇩🇪Germany jurgenhaas Gottmadingen
In that case, you need to build something into your model which gives you the list of all those webforms and then you need to loop over that list and close one after the other. The library of the ECA Guide at https://ecaguide.org contains a ton of samples that demonstrate how to do that with views and how to loop over the returned items.
Thank you again for your help, Jurgen. I have worked through a solution. Great module!
Best regards,
Brian
- Status changed to Fixed
over 1 year ago 5:59am 18 July 2023 Automatically closed - issue fixed for 2 weeks with no activity.
- Status changed to Fixed
7 months ago 2:52pm 12 April 2024 @jurgenhass, could you elaborate on #4 please? For now with now logic in place and have an event that when a certain webform is Viewed, it will close it and display a message. Message displays fine for just that webform, great but it's closing part that confused me. I have the close webform action in place and I see that you need an action before that, that somehow stores the entity id of the webform and passes it to the close webform action? I've tried to figure out what template that would be with no luck.