Problem/Motivation

The old global functions drupal_get_message() and drupal_set_message() have been deprecated as of Drupal 8.5, which introduces the new \Drupal\Core\Messenger\Messenger service. Compare https://www.drupal.org/node/2774931.

As OpenID Connect still has no stable release, and the old functions may be removed before Drupal 9, we should replace the used drupal_set_message() calls by the new service for the first RC. (Which implies a dependency on Drupal Core 8.5+.)

Proposed resolution

Replace drupal_set_message() calls by the new \Drupal\Core\Messenger\Messenger service.

Remaining tasks

Create a patch.

User interface changes

None.

API changes

Dependency on Drupal Core higher than 8.5-alpha1.

Data model changes

None.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Mario Steinitz created an issue. See original summary.

  • Mario Steinitz committed 11d078f on 8.x-1.x
    Issue #2961752: Replace 'drupal_set_message()' with messenger service in...
Mario Steinitz’s picture

Status: Active » Fixed
sun’s picture

Priority: Normal » Critical
Status: Fixed » Needs work

This causes a fatal error on sites trying to install the module, as the required drupal/core version was not bumped to 8.5.0 in composer.json and the info file.

sun’s picture

Status: Needs work » Active
sun’s picture

Status: Active » Needs review
Related issues: +#2641658: Module version dependency in .info.yml is ineffective for patch releases
FileSize
361 bytes
sun’s picture

composer.json was (accidentally) updated by #2961938: Move global module functions to a dedicated service class already… which is terribly confusing, but alas, yet another one of these issues sans reviews.

sun’s picture

  • Mario Steinitz committed e002d7e on 8.x-1.x
    Revert "Issue #2961752: Replace 'drupal_set_message()' with messenger...
Mario Steinitz’s picture

Reverted these changes. Attached please find a patch for this issue for review. I also created a new parent issue that allows to keeping track of changes that would add a dependency in Drupal Core 8.5+.

sun’s picture

It is still not possible to install 8.x-1.x right now.

HEAD is still broken, because a simple revert of this commit here did not remove all remnants of the messenger service, which was incorporated into #2961938: Move global module functions to a dedicated service class

sun’s picture

Category: Task » Bug report
FileSize
6.04 KB

Attached patch completes the revert.

Mario Steinitz’s picture

Category: Bug report » Feature request
Priority: Critical » Normal
FileSize
4.35 KB

As we are at Core v8.7.1 right now, I strongly suggest moving on with changes that were postponed due to their dependency in Core 8.5+.

An updated patch attached.

hirvinen’s picture

FileSize
4.56 KB

The previous patches have some issues, such superfluous use MessengerTrait; (inherited from ControllerBase anyway), and not ensuring that the messenger has been acquired, leading to calling addError and addStatus on NULL. The attached patch fixes this and similar issue in OpenIDConnectedAccountsForm.

hirvinen’s picture

Fix patch filename format.

solideogloria’s picture

I think this issue could be closed as a duplicate of #3112173: Drupal9 deprecations.

jcnventura’s picture

Status: Needs review » Closed (duplicate)

Yes, it can.