The sector_utils module adds a class to all unpublished entities via hook_ds_pre_render_alter(), but not all entities have a published/unpublished status with recent changes to Drupal core.

This throws an undefined method if an entity that doesn't implement the publishable trait is rendered in any view mode other than "full".

An example from the entity provided by the profile module:

Error: Call to undefined method Drupal\profile\Entity\Profile::isPublished()

The fix is simply to check for EntityPublishedInterface before calling the method.

Comments

dieuwe created an issue. See original summary.

dieuwe’s picture

dieuwe’s picture

Issue summary: View changes
danielveza’s picture

Status: Active » Reviewed & tested by the community

Makes sense. EntityInterface indeed no long has isPublished.

Patch still appies, lets get this in.

  • Chroid committed e8cf763 on 8.x-4.x authored by dieuwe
    Issue #3123687 by dieuwe, DanielVeza, Chroid: Check...
chroid’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed.

Status: Fixed » Closed (fixed)

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