Replace use of access_check.node.add service. Service removed in D10

Created on 20 November 2023, about 1 year ago
Updated 7 December 2023, 12 months ago

Problem/Motivation

Service 'access_check.node.add' is removed in D10.

Steps to reproduce

With this module installed on D10, clearing and rebuilding Drupal caches leads to the error:

In CheckExceptionOnInvalidReferenceBehaviorPass.php line 86:
                                                                               
  The service "epub_reader_framework.reader_publication_form_alter" has a dep  
  endency on a non-existent service "access_check.node.add". Did you mean one  
   of these: "access_check.default", "access_check.theme", "access_check.node  
  .preview"?                                                                   
                                                                               

Proposed resolution

Replace with a check against the node access handler, retrieved from the entity_type storage.

$access_check = $this->entityTypeManager
        ->getAccessControlHandler('node');
      if ($access_check->createAccess('reader_chapter', $user, [], FALSE)) {..}
🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024