Problem/Motivation

Autoloading hooks in the file (entity.views.inc) is deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. Move the functions in this file to either the .module file or other appropriate location. See https://www.drupal.org/node/3489765

Proposed resolution

Move the contents of entity.views.inc to the main module file.

Remaining tasks

Make the changes.

User interface changes

n/a

API changes

n/a

Data model changes

n/a

Issue fork entity-3553240

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

damienmckenna created an issue. See original summary.

damienmckenna’s picture

Status: Active » Needs review

The MR moves entity_views_data().

orkutmuratyilmaz’s picture

Tested MR !47 on Drupal 12.0.0-beta1 with Mapillary (https://www.drupal.org/project/mapillary), which uses the Entity API access, permission and query access handlers on four content entity types and BundleEntityAccessControlHandler on their bundles.

Environment

The change is needed on Drupal 12

In 12.0.0-beta1, HookCollectorPass no longer collects the hook_hook_info() group include files; the $module.$group.inc handling from 11.x is gone. entity_views_data() in entity.views.inc would not be found. With the MR it is in entity.module.

Mapillary's entity types are not revisionable, so its tests do not reach the revision Views data that entity_views_data() builds. They cover the rest of the module on Drupal 12.

Drupal 12 still refuses to install Entity API

The MR does not change core_version_requirement in entity.info.yml, which is "^10.1 || ^11" on 8.x-1.x. Installing on 12.0.0-beta1 fails:

Drupal\Core\Extension\MissingDependencyException: Unable to install modules: module 'entity' is incompatible with this version of Drupal core.

Every Functional test of a module that depends on entity stops there. After adding || ^12 to entity.info.yml locally (as the lenient next major job of GitLab CI does), everything below passes.

Result with ^12 added locally

  • Mapillary Unit, Kernel and Functional tests (98 classes) run on Drupal 12. All 24 Functional classes pass, including the admin Views listings with query access and entity access. The Kernel tests for the handlers, the generated permissions and the access matrix per entity type and bundle pass too.
  • No failure comes from Entity API. The remaining failures are in Mapillary's own tests, plus one Drush command test, since Drush 13 cannot be installed with Drupal 12's Symfony 8 and Guzzle 8.
  • Entity API triggers Drupal 13 deprecations only: annotation-based plugins (@ViewsField for entity_link_revision and entity_link_revision_revert, @Action for entity_delete_action; #3614512: Convert the remaining plugin annotations to PHP attributes converts them) and return types the DebugClassLoader asks for (QueryAccessHandler::createInstance(), getEntityLinkTemplate(), ModuleUninstallValidatorInterface::validate()).

Could the MR also add ^12 to core_version_requirement, or is that planned in a separate issue?

berdir’s picture

Title: Autoloading hooks in files are deprecated » Convert hooks to OOP
Status: Needs review » Needs work

As usual, I'm not interested in the minimal fix to move the hook, we just have to touch it twice then, lets expand this to convert all hooks to OOP. I'll try to reviewing and merging a few other issues first before working on that myself to minimize conflicts.

berdir’s picture

Title: Convert hooks to OOP » Convert hooks to OOP and D12 compatibility

berdir’s picture

Title: Convert hooks to OOP and D12 compatibility » Convert hooks to OOP
Status: Needs work » Needs review

I'll do a separate issue for D12, plugins and other things.

  • berdir committed 710e4bd6 on 8.x-1.x
    task: #3553240 Convert hooks to OOP
    
    By: damienmckenna
    By: berdir
    
berdir’s picture

Status: Needs review » Fixed

Merged.

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.

orkutmuratyilmaz’s picture

thank you @berdir for the fix :)