In line 617 of views.api.php:

  $entity_type_id = $field->entity_type;

The entity_type property is protected. Should it use $field->getTargetEntityTypeId()?

Proposed solution:
Use getTargetEntityTypeId

CommentFileSizeAuthor
#3 3327974-3.patch811 byteslendude

Comments

ExTexan created an issue. See original summary.

cilefen’s picture

Version: 9.4.x-dev » 9.5.x-dev
Issue tags: +Documentation
lendude’s picture

Issue summary: View changes
StatusFileSize
new811 bytes

I don't think $field->getEntityType() is right, that would get the config entity type for the field, right? It wants to have the entity type the field is connected to so that would need $field->getTargetEntityTypeId()

Added patch

lendude’s picture

Status: Active » Needs review
joachim’s picture

Status: Needs review » Reviewed & tested by the community

LGTM.

xjm’s picture

Title: In views.api.php, entity_type is protected » The $entity_type property is protected, so fix views.api.php sample code to use a getter

  • xjm committed bc41ac89 on 10.1.x
    Issue #3327974 by Lendude, ExTexan: The $entity_type property is...

  • xjm committed 7447663e on 10.0.x
    Issue #3327974 by Lendude, ExTexan: The $entity_type property is...

  • xjm committed 0c750a24 on 9.5.x
    Issue #3327974 by Lendude, ExTexan: The $entity_type property is...
xjm’s picture

Status: Reviewed & tested by the community » Fixed

Nice find. Commited to 10.1.x, and cherry-picked to 10.0.x and 9.5.x as a patch-eligible documentation bugfix. Thanks!

Status: Fixed » Closed (fixed)

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