Printing view error - Call to a member function getExecutable() on null

Created on 26 April 2023, over 1 year ago
Updated 27 April 2023, over 1 year ago

Problem/Motivation

I tired to use the link "/print/view/pdf/view_name/view_display_id/view_agrs[]={{nid}}" to print the node content based on @benjy suggestion ( https://www.drupal.org/project/entity_print/issues/2907320#comment-12258110 ).
The error below occurs:

Error: Call to a member function getExecutable() on null in Drupal\entity_print_views\Controller\ViewPrintController->checkAccess() (line 168 of modules/contrib/entity_print/modules/entity_print_views/src/Controller/ViewPrintController.php).

Please advise! Thank you,

Steps to reproduce

Drupal Core: 9.4.11
PHP version: 8.0
Print engine: Dompdf

1. Create a simple content view (name:node_content_view) with a single title field.
2) Leave the default view display id as page_1.
3) Access the link http://www.localhost/en/print/view/pdf/node_content_view/page_1?view_arg...

As a result, the error (Call to a member function getExecutable() on null ) occurs.

The $this->entityTypeManager->getStorage('view')->load($view_name) returns NULL in the line 168 of function checkAccess in ViewPrintController.php

  public function checkAccess($export_type, $view_name, $display_id) {
    $view = $this->entityTypeManager->getStorage('view')->load($view_name)->getExecutable();
    $account = $this->currentUser();
    ...................................
  }

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

🇨🇦Canada jamesyao

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

Comments & Activities

Production build 0.71.5 2024