Problem/Motivation

I found a typo in the method blockdAccess that should be blockAccess.
With that fixed, inside this method there is also a call to a not injected service $this->navigationExtra
Without this, the block can’t decide if it should render, and you end up with a block showing even when the plugin (and its page attachments) are disabled.

Steps to reproduce

Just look at the code at

Proposed resolution

Correct the method and inject the navigation_extra.manager service.

Remaining tasks

Create MR.

User interface changes

None.

API changes

None.

Data model changes

None.

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

tim-diels created an issue. See original summary.

tim-diels’s picture

Status: Active » Needs review
dtfabio’s picture

Assigned: Unassigned » dtfabio
dtfabio’s picture

Assigned: dtfabio » Unassigned
Status: Needs review » Reviewed & tested by the community

Hi Tim,

I tested the code change on three different Drupal instances.

Drupal core versions: 10.3.14, 10.6.3 and 11.3.3
PHP versions: 8.3.30 (10.3) and 8.4.18 for the newer core versions.
Database version: MariaDB 11.8.6

When I just quickly fix the typo, the site crashes on all three instances with the following error:

Error: Call to a member function isEnabled() on null in Drupal\navigation_extra\Plugin\Block\NavigationExtraVersionBlock->blockAccess() (line 62 of /var/www/html/web/modules/contrib/navigation_extra/src/Plugin/Block/NavigationExtraVersionBlock.php)

The MR code fixes the typo, solves the problem and ensures that the site becomes available again, so this ticket can be set to RTBC.

Greetings,

Fabio

  • tim-diels committed 26102094 on 1.0.x
    fix: #3572823 Typo in method name and calling not injected service
    
    By:...
tim-diels’s picture

Status: Reviewed & tested by the community » Fixed

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.

Status: Fixed » Closed (fixed)

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