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
CommentFileSizeAuthor
#2 undefined-get-title-2547391-1.patch730 bytesdpopdan
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dpopdan created an issue. See original summary.

dpopdan’s picture

This error was caused by the fact that it considers that the field is always used on nodes, replacing getTitle() with label() fix the error.

dpopdan’s picture

Status: Active » Needs review

  • guschilds committed 44e5e43 on 8.x-1.x authored by dpopdan
    Issue #2547391 by dpopdan, guschilds: Fixed undefined method error when...
  • guschilds committed e349366 on 8.x-1.x
    Issue #2547391 by dpopdan, guschilds: Fixed undefined method error when...
guschilds’s picture

Status: Needs review » Fixed

Thanks, 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.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.