Mentions prevents saving of content with empty text field

Created on 7 January 2023, almost 2 years ago
Updated 30 January 2023, almost 2 years ago

Problem/Motivation

When creating content programmatically (Node::create()) the mentions module throws the following error if a text field (the body field in my case) is empty.

TypeError: Drupal\mentions\Plugin\Filter\MentionsFilter::getMentions(): Argument #1 ($text) must be of type string, null given,

Steps to reproduce

  1. Install and configure the mentions module.
  2. In a custom module, create a node with an empty body field using Node::create()
  3. Attempt to run the code in the module.

Proposed resolution

Validate that the field value is not empty in the mentions_insert_or_update() function.

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States oo0shiny

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

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.71.5 2024