Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
The website encountered an unexpected error. Please try again later.
Error: Call to a member function getThirdPartySetting() on null in block_aria_landmark_roles_preprocess_block() (line 51 of modules/contrib/block_aria_landmark_roles/block_aria_landmark_roles.module).
Proposed resolution
Add condition to make sure the block is exist before calling the function.
if ($block) {
if ($role = $block->getThirdPartySetting('block_aria_landmark_roles', 'role')) {
$variables['attributes']['role'] = $role;
}
if ($label = $block->getThirdPartySetting('block_aria_landmark_roles', 'label')) {
$variables['attributes']['aria-label'] = $label;
}
}
Comment | File | Size | Author |
---|---|---|---|
#7 | block_aria_landmark_roles.patch | 506 bytes | Harry Slaughter |
#3 | 3219433-1.patch | 1.06 KB | phuang07 |
#2 | 3219433.patch | 1.06 KB | phuang07 |
Issue fork block_aria_landmark_roles-3219433
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
Comment #2
phuang07 CreditAttribution: phuang07 commentedComment #3
phuang07 CreditAttribution: phuang07 commentedComment #4
opdaviesAre there any particular steps needed to replicate the error?
Comment #5
opdaviesComment #6
dalemoore CreditAttribution: dalemoore commentedI'm having the same issue. Didn't occur until I upgraded Drupal (now on 8.9.16) to my knowledge. Now get a WSOD with the following error message:
Similar issue: https://www.drupal.org/project/block_class/issues/2917683
Comment #7
Harry SlaughterI've been testing the module. It worked fine when using the standard blocks config page (/admin/structure/block). But when I started to configure blocks via context module, I started getting the same error.
It seems to be choking on any null $block value. This patch is probably not an ideal solution, but it works.
Comment #8
smustgrave CreditAttribution: smustgrave at Mobomo commentedCurrently working on 2.0.0 release.
This has been PNMI for almost 2 years so unless it's still happening on 2.0.x branch going to close.
Feel free to reopen if you are still seeing issue.
Thanks!
Comment #9
o_timoshchuk CreditAttribution: o_timoshchuk at DevBranch, Drupal Ukraine Community, Evolving Web commentedI have the same issues with version 2.0.1. The patch #7 fixes it
Comment #10
smustgrave CreditAttribution: smustgrave at Mobomo commentedComment #13
smustgrave CreditAttribution: smustgrave at Mobomo commentedEnded up using an instance check.