Submitting form throws error: Call to a member function addMessage()

Created on 12 January 2024, 11 months ago
Updated 15 January 2024, 11 months ago

Problem/Motivation

When editing module config page and saving changes I get error:

Error: Call to a member function addMessage() on null in Drupal\node_title_validation\Form\NodeTitleValidationAdminForm->submitForm() (line 228 of /var/www/html/web/modules/contrib/node_title_validation/src/Form/NodeTitleValidationAdminForm.php)

Proposed resolution

Replace node_title_validation/src/Form/NodeTitleValidationAdminForm.php line 228 from
$this->messenger->addMessage($this->t('Node Title Validation Configurations saved successfully!'));
to
$this->messenger()->addMessage($this->t('Node Title Validation Configurations saved successfully!'));

🐛 Bug report
Status

RTBC

Version

2.0

Component

Code

Created by

🇫🇮Finland eskowe

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