ai_content_suggestions - issue while adding blocks on landing pages

Created on 11 December 2025, 2 days ago

Problem/Motivation

Error: Call to undefined method Drupal\layout_builder\Form\AddBlockForm::getEntity() in Drupal\ai_content_suggestions\AiContentSuggestionsFormAlter->alter() (Zeile 40 in /mnt/www/html/syngentacpd901dev/docroot/modules/contrib/ai/modules/ai_content_suggestions/src/AiContentSuggestionsFormAlter.php).

Steps to reproduce (required for bugs, but not feature requests)

1. Create landing page
2. Add CTA blocks on that page

Proposed resolution

The error occurs because the code assumes all form objects have the getEntity() method, but AddBlockForm from Layout Builder doesn't.

1. Added a check to verify if the form object implements ContentEntityFormInterface
2. Skip the current iteration if it's not a content entity form
3. Added proper type checking before calling getEntity()

Remaining tasks

Optional: Other details as applicable (e.g., User interface changes, API changes, Data model changes)

🐛 Bug report
Status

Active

Component

Code

Created by

🇮🇳India PunamShelke India

Live updates comments and jobs are added and updated live.
  • Blocks-Layouts

    Blocks and Layouts Initiative. See the #2811175 Add layouts to Drupal issue.

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