- Issue created by @danharper
- First commit to issue fork.
- @priti197 opened merge request.
- 🇬🇧United Kingdom danharper
Hi,
With the patch I still get en error but it's slightly different, when I looked at the code I noticed there is an declared $node variable in the patch too.
Error: Call to a member function get() on null in Drupal\user_selected_formatter\UserSelectedFormatterService->getPresetByTargetField() (line 41 of modules/contrib/user_selected_formatter/src/UserSelectedFormatterService.php).
It might be the context I am using this which causes the problem. I have a custom block with image field that I am using in layout builder as even with the patch if i do the following.
- I create a new page
- Switch to layout builder
- Add image block tjat has image field and formatters on
The block will not save and this is in the log file,
Error: Call to a member function get() on null in Drupal\user_selected_formatter\UserSelectedFormatterService->getPresetByTargetField() (line 41 of /app/web/modules/contrib/user_selected_formatter/src/UserSelectedFormatterService.php)
Message Warning: Undefined variable $node in Drupal\user_selected_formatter\UserSelectedFormatterService->getPresetByTargetField() (line 41 of /app/web/modules/contrib/user_selected_formatter/src/UserSelectedFormatterService.php
Thanks Dan