Problem/Motivation

Per #3484105: Automatically included .inc files are no longer included and https://www.drupal.org/node/3489765 , Drupal will no longer automatically pick up *.inc files. The entity module includes an entity_views_data() hook in entity.views.inc. On Drupal 12, this hook is no longer discovered, leading to downstream problems for modules that implement the Entity API.

Steps to reproduce

1. Install a site on Drupal 12 and enable the Entity module (bypassing/modifying the core_version_requirement)
2. Implement a module that implements a ContentEntity type that has a views_data handler.
3. Create a View of this Content Entity type.
4. Fatal error, with "InvalidArgumentException: Class "entity_views_data" does not exist"

Proposed resolution

For the time being, move the implementation of entity_views_data to to the .module file.

Remaining tasks

In a subsequent task, for Drupal 13, which drops support of .module files, all of the hooks in the .module file will need to be relocated to object-oriented equivalents.

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Issue fork entity-3610940

Command icon 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:

Comments

mark_fullmer created an issue. See original summary.

mark_fullmer’s picture

Status: Active » Needs review

daften made their first commit to this issue’s fork.

daften’s picture

I merged 8.x-1.x into the fork, to allow merging, since entity_views.inc was changed through #3331201

orkutmuratyilmaz’s picture

I have 8.x-1.8 (without any patches) installed on my Drupal environment and upgrade_status says, there's only one problem for D12 upgrade:

  • file: web/modules/contrib/entity/entity.info.yml
  • line: 4
  • problem: Value of core_version_requirement: ^10.1 || ^11 is not compatible with the next major version of Drupal core. See https://drupal.org/node/3070687.

Since this issue is about D12 compatibility, I wanted to add this comment here.

damienmckenna’s picture

Status: Needs review » Closed (duplicate)
Parent issue: » #3553240: Convert hooks to OOP

This is a duplicate of #3553240: Convert hooks to OOP.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.