Error: Call to undefined method for [message:node-url] token

Created on 9 October 2020, over 3 years ago
Updated 30 January 2024, 5 months ago

Problem/Motivation

A white screen of death appears with a PHP error from using the token [message:node-url] in the following Example - Create node message template:

<p><a href="[message:user-url]">[message:author:display-name]</a> created <a href="[message:node-url]">[message:node-title]</a></p>

Error: Call to undefined method Drupal\node\Entity\Node::url() in message_example_tokens() (line 110 of C:\MAMP\htdocs\dev\web\modules\contrib\message\modules\message_example\message_example.tokens.inc)

Steps to reproduce

  1. Install the message example sub module
  2. Edit the Example - Create node message template to include [message:node-url] token
  3. Check only the Token replace option and save message template
  4. View messages on /admin/content/message

This message template works with the [message:node-url] token removed:
<p><a href="[message:user-url]">[message:author:display-name]</a> created [message:node-title]</p>

πŸ› Bug report
Status

Fixed

Version

1.1

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada chrisck

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024