Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion gesso_helper/src/Element/GessoButton.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Render\BubbleableMetadata;
use Drupal\Core\Render\Element\RenderElementBase;
use Drupal\Core\Render\Element\RenderElement;
use Drupal\Core\Url as CoreUrl;

/**
Expand Down Expand Up @@ -33,7 +34,7 @@
* ];
* @endcode
*
* @RenderElementBase("gesso_button")
* @RenderElement("gesso_button")
*/
class GessoButton extends RenderElementBase {

Expand Down
3 changes: 2 additions & 1 deletion gesso_helper/src/Element/GessoIcon.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
namespace Drupal\gesso_helper\Element;

use Drupal\Core\Render\Element\RenderElementBase;
use Drupal\Core\Render\Element\RenderElement;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don’t need this line since we never use RenderElement in this file and Drupal automatically imports annotation classes.


/**
* Provides an SVG icon element.
*
* @RenderElementBase("gesso_icon")
* @RenderElement("gesso_icon")
Comment on lines +6 to +11
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

find . -name "GessoIcon.php" -type f

Repository: forumone/gesso

Length of output: 98


🏁 Script executed:

fd -t f "GessoIcon.php" | head -20

Repository: forumone/gesso

Length of output: 96


🌐 Web query:

Drupal RenderElement annotation class name Drupal 10 11

💡 Result:

In Drupal 10 and Drupal 11, the render-element plugin annotation class is:

  • \Drupal\Core\Render\Annotation\RenderElement (used as @RenderElement("my_element")) [1], [2]

However, in Drupal 10.3+ and Drupal 11, core render/form elements are also (and increasingly) defined using PHP attributes:

  • \Drupal\Core\Render\Attribute\RenderElement (and for form elements: \Drupal\Core\Render\Attribute\FormElement) [3]

Sources:
[1] Drupal API: Annotation group lists RenderElement and its file core/lib/Drupal/Core/Render/Annotation/RenderElement.php
[2] Drupal API: Example showing @RenderElement("view")
[3] Drupal API “Form and render elements” list showing \Drupal\Core\Render\Attribute\RenderElement / \Drupal\Core\Render\Attribute\FormElement


🏁 Script executed:

cat -n gesso_helper/src/Element/GessoIcon.php

Repository: forumone/gesso

Length of output: 1790


Import the annotation class, not the element base class.

Line 6 imports Drupal\Core\Render\Element\RenderElement, but the @RenderElement annotation requires Drupal\Core\Render\Annotation\RenderElement. The current import prevents proper annotation discovery, causing the gesso_icon render element to fail registration.

Suggested fix
-use Drupal\Core\Render\Element\RenderElement;
+use Drupal\Core\Render\Annotation\RenderElement;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
use Drupal\Core\Render\Element\RenderElement;
/**
* Provides an SVG icon element.
*
* @RenderElementBase("gesso_icon")
* @RenderElement("gesso_icon")
use Drupal\Core\Render\Annotation\RenderElement;
/**
* Provides an SVG icon element.
*
* `@RenderElement`("gesso_icon")
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@gesso_helper/src/Element/GessoIcon.php` around lines 6 - 11, The import at
the top of GessoIcon.php is wrong for the annotation: replace the current import
of Drupal\Core\Render\Element\RenderElement with the annotation class
Drupal\Core\Render\Annotation\RenderElement so the `@RenderElement`("gesso_icon")
annotation on the GessoIcon class is discoverable and the render element
registers correctly; update the use statement in GessoIcon.php accordingly and
keep the existing `@RenderElement` annotation intact.

*/
class GessoIcon extends RenderElementBase {

Expand Down
3 changes: 2 additions & 1 deletion gesso_helper/src/Element/GessoIconLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Render\BubbleableMetadata;
use Drupal\Core\Render\Element\RenderElementBase;
use Drupal\Core\Render\Element\RenderElement;
use Drupal\Core\Url as CoreUrl;

/**
Expand Down Expand Up @@ -33,7 +34,7 @@
* ];
* @endcode
*
* @RenderElementBase("gesso_icon_link")
* @RenderElement("gesso_icon_link")
*/
class GessoIconLink extends RenderElementBase {

Expand Down