Problem/Motivation
We got an error on a page that was previously working fine.
Error: Call to a member function get() on null in Drupal\media_video_micromodal\Plugin\Field\FieldFormatter\MicromodalFieldFormatter->viewElements() (regel 324 van web/modules/contrib/media_video_micromodal/src/Plugin/Field/FieldFormatter/MicromodalFieldFormatter.php)
| Comment | File | Size | Author |
|---|
Issue fork media_video_micromodal-3485050
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3485050-error-when-no
changes, plain diff MR !7
Comments
Comment #3
joshahubbers commentedThe patch file for use in composer
Comment #4
joshahubbers commentedComment #6
scott_earnest commentedHi and thank you for catching this. Maybe there was a referenced entity that was removed? I was able to duplicate the issue by zero-ing out the "target_id" so that it would not load the media or thumbnail correctly:
Regarding your patch, I feel that the thumbnail_file_id needed to be set either way, even if to false, but further down needed some checks.
I have pushed a fix to the 1.x-dev branch.
Testing Instructions
- Use the MVM formatter with "Custom Thumbnail Media Reference" display
- Use the code block above to manually alter the target id
- Verify the page still loads, but the MVM item would not display since the thumbnail did not exist
Comment #8
scott_earnest commentedComment #9
scott_earnest commentedTested on:
Drupal 10.3.6
Drupal 11.0.5
RTBC +1
pushing this to new release
Comment #10
scott_earnest commentedComment #11
scott_earnest commentedComment #12
scott_earnest commentedComment #13
scott_earnest commentedThanks @joshahubbers!
Comment #14
joshahubbers commentedGreat. Thank you for the fix and your effort.