[MAGNOLIA-4457] AdHoc area definition is never created Created: 27/Jun/12  Updated: 15/Mar/21  Resolved: 15/Mar/21

Status: Closed
Project: Magnolia
Component/s: templating
Affects Version/s: 4.5
Fix Version/s: 4.5.x

Type: Bug Priority: Major
Reporter: Jan Haderka Assignee: Unassigned
Resolution: Won't Fix Votes: 1
Labels: next
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

at least what the code here looks like (AreaElement):

        this.isAreaDefinitionEnabled = areaDefinition != null && (areaDefinition.isEnabled() == null || areaDefinition.isEnabled());

        if (!this.isAreaDefinitionEnabled) {
            return;
        }
        // set the values based on the area definition if not passed
        this.name = resolveName();
        this.dialog = resolveDialog();
        this.type = resolveType();
        this.label = resolveLabel();
        this.availableComponents = resolveAvailableComponents();
        this.inherit = isInheritanceEnabled();
        this.optional = resolveOptional();
        this.editable = resolveEditable();

        this.description = templateDefinition.getDescription();

        // build an adhoc area definition if no area definition can be resolved
        if(this.areaDefinition == null){
            buildAdHocAreaDefinition();
        }

When areaDefinition is null, whole condition will be evaluated as false and will return on the next line never reaching code below that would actually create it ad-hoc.

Either it should be created in which case whole code should be refactored, or it should not in which case second if clause should be removed.

While we are at it, what is the reason for AreaDefinition#isEnabled() returning boolean object rather then primitive?



 Comments   
Comment by user-4f778 (Inactive) [ 13/Jun/19 ]

I had some hopes when I found this method. It would be rather convenient to integrate components like tag managers.

It would allow adding an area from custom module with one line:

[@cms.area templateScript="/my-module/templates/misc/close.ftl"/]

or

[@cms.area template="my-module:areas/close"/]

without complementing it with an Area Definition section in Page Template Definition.

Generated at Mon Feb 12 03:55:58 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.