Skip to content

Fatal error in Elementor editor on Elementor versions older than 3.19: undefined Controls_Manager::NOTICE #567

Description

@code-snippets-bot

Problem

With Code Snippets 3.10.0 or newer active, opening the Elementor editor on a site running Elementor older than 3.19 produces a fatal error:

PHP Fatal error: Uncaught Error: Undefined constant Elementor\Controls_Manager::NOTICE in wp-content/plugins/code-snippets/php/Integration/Promotions/Other/Elementor_Editor.php:53

The Elementor editor becomes unusable. The rest of wp-admin and the frontend are unaffected because the promotion callbacks only run inside the Elementor editor.

Root cause

Elementor_Editor::add_promotion_control() (introduced in 3.10.0, commit 2f8f7cd) registers the Elementor Custom CSS promotion control with:

'type' => Controls_Manager::NOTICE,

The NOTICE control type was introduced in Elementor 3.19 (Elementor 3.19 developers update: https://developers.elementor.com/elementor-3-19-developers-update). On older Elementor versions the constant does not exist, so evaluating the control definition throws a fatal Error while the editor renders.

Verified from source: the unguarded reference ships in 3.10.0, 3.10.1, 3.10.2, and is still present on the current development branch.

Expected behavior

The plugin degrades gracefully on older Elementor versions: skip the promotion (or render a compatible control) instead of fatalling the editor.

Acceptance criteria

  • Guard the promotion registration so it only runs when the NOTICE control type exists (for example an Elementor version check for 3.19+, or an equivalent defined-constant check).
  • Opening the Elementor editor with Elementor older than 3.19 and Code Snippets active produces no fatal and no banner.
  • The promotion still renders correctly on current Elementor versions.
  • Regression coverage for the guard.

Related: #550 covered the duplicate registration of this same promotion control on current Elementor versions; this report is the older-Elementor fatal variant of the same integration.

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions