Skip to content

Added config option to hide Content field#15

Closed
purplespider wants to merge 2 commits into
dynamic:masterfrom
purplespider:feature-disable-content
Closed

Added config option to hide Content field#15
purplespider wants to merge 2 commits into
dynamic:masterfrom
purplespider:feature-disable-content

Conversation

@purplespider

Copy link
Copy Markdown

Personally, I prefer my blocks simpler and more modular, so have added a config option to hide the recently added Content field.

Dynamic\Elements\Embedded\Elements\ElementEmbeddedCode:
  hide_content_field: true

@jsirish

jsirish commented Jun 5, 2026

Copy link
Copy Markdown
Member

Preparing review...

@jsirish

jsirish commented Jun 5, 2026

Copy link
Copy Markdown
Member

PR Reviewer Guide 🔍

(Review updated until commit 2a05825)

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Static Config Call

Using ElementEmbeddedCode::config()->get('hide_content_field') with a hardcoded class name instead of static::config() or self::config() makes the configuration less flexible for subclasses. If a developer extends this class and sets hide_content_field on the subclass, the parent class will still check its own config. Use static::config()->get('hide_content_field') to allow proper inheritance of configuration.

if (ElementEmbeddedCode::config()->get('hide_content_field')) {
    $fields->removeByName('Content');
}

@jsirish

jsirish commented Jun 5, 2026

Copy link
Copy Markdown
Member

Persistent review updated to latest commit 2a05825

1 similar comment
@jsirish

jsirish commented Jun 9, 2026

Copy link
Copy Markdown
Member

Persistent review updated to latest commit 2a05825

@jsirish

jsirish commented Jun 15, 2026

Copy link
Copy Markdown
Member

Superseded by #25, which reimplements this on the active 4 branch (this PR targeted the deprecated master) and uses static::config() instead of a hardcoded ElementEmbeddedCode::config() so subclasses can override the flag. Thanks for the contribution — the feature lives on in #25.

@jsirish jsirish closed this Jun 15, 2026
jsirish added a commit that referenced this pull request Jun 15, 2026
Adds a `hide_content_field` config flag (default false) that removes the Content field from the CMS edit form. Uses `static::config()` for subclass-safe late static binding. Replaces PR #15 which targeted the deprecated master branch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants