Problem/Motivation

drupal_set_message is deprecated

Proposed resolution

use Drupal::messager

Comments

thalles created an issue. See original summary.

thalles’s picture

Status: Needs work » Needs review
StatusFileSize
new1.92 KB

Follow the patch!

thalles’s picture

Title: Use Drupal::messager » Use Drupal::messenger
hass’s picture

Status: Needs review » Needs work

drupal_get_messages is missing

thalles’s picture

Follow the patch!

thalles’s picture

Status: Needs work » Needs review
hass’s picture

What is the difference between addMessage and addStatus? In GA you used addStatus and here addMessage in .install. What is right now for the same code?

  • hass committed 1bb074c on 8.x-1.x authored by thalles
    Issue #3029293 by thalles, hass: Use Drupal::messenger
    

Status: Needs review » Needs work

The last submitted patch, 5: matomo-Use_Drupal_messager-3029293-5-D8.patch, failed testing. View results

hass’s picture

Status: Needs work » Fixed
hass’s picture

Do you know how we can add a dependency for CORE 8.5 and higher?

thalles’s picture

What is the difference between addMessage and addStatus? In GA you used addStatus and here addMessage in .install. What is right now for the same code?
The addMessage works as a drupal_set_message, \Drupal::messenger()->addMessage('New message', 'status'); and addStatus is only used to add status type messages.

  /**
   * Adds a new message to the queue.
   *
   * The messages will be displayed in the order they got added later.
   *
   * @param string|\Drupal\Component\Render\MarkupInterface $message
   *   (optional) The translated message to be displayed to the user. For
   *   consistency with other messages, it should begin with a capital letter
   *   and end with a period.
   * @param string $type
   *   (optional) The message's type. Either self::TYPE_STATUS,
   *   self::TYPE_WARNING, or self::TYPE_ERROR.
   * @param bool $repeat
   *   (optional) If this is FALSE and the message is already set, then the
   *   message won't be repeated. Defaults to FALSE.
   *
   * @return $this
   */
  public function addMessage($message, $type = self::TYPE_STATUS, $repeat = FALSE);
thalles’s picture

I think it would look like this:

dependencies:
  - blazy:blazy (>= 2.x)

But then the installation would have to be done using the composer

Status: Fixed » Closed (fixed)

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