Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
After I added this field on blocks, I got the following error
Fatal error: Call to undefined method Drupal\block_content\Entity\BlockContent::getTitle() in /modules/contrib/youtube/src/Plugin/Field/FieldFormatter/YouTubeFormatter.php on line 154
Comment | File | Size | Author |
---|---|---|---|
#2 | undefined-get-title-2547391-1.patch | 730 bytes | dpopdan |
Comments
Comment #2
dpopdan CreditAttribution: dpopdan commentedThis error was caused by the fact that it considers that the field is always used on nodes, replacing getTitle() with label() fix the error.
Comment #3
dpopdan CreditAttribution: dpopdan commentedComment #5
guschilds CreditAttribution: guschilds at Chromatic commentedThanks, dpopdan! The fix worked and was committed. I also committed the same fix when rendering a thumbnail. As a heads up, I had to apply the patch manually because it lists the full path to the module in your installation. Creating the patch from a fresh checkout of the repo solves that problem.