Use "granite:class" and "granite:data" in the new CF editor | Community
Skip to main content
daniel-strmecki
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
March 11, 2025
Investigating

Use "granite:class" and "granite:data" in the new CF editor

  • March 11, 2025
  • 2 replies
  • 318 views
Request for Feature Enhancement (RFE) Summary: Ability to use "granite:class" and "granite:data" in the new CF editor
Use-case:

We developed a show/hide fields plugin for the new CF editor based on a type selection made in a select field. For this purpose we used the example provivided in the docs:

https://developer.adobe.com/uix/docs/services/aem-cf-editor/api/data/#setting-styles-to-the-field

api.setStyles(fieldName, {"display": "none"});

However, this is not an optimal solution, as we need to hide each field per name instead of creating a generic plugin that could be reused on any content fragment. If we had an option to retrieve the value of a custom data attribute, then our plugin could be reusable.

Current/Experienced Behavior: The "granite:class" and "granite:data" set in the CF model is not present in the HTML, and custom data attributes cannot be retrieved by custom plugins.
Improved/Expected Behavior: The "granite:class" and "granite:data" set in the CF model is present in the HTML, and custom data attributes can be retrieved by custom plugins.
Environment Details (AEM version/service pack, any other specifics if applicable): AEMaaCS, release 2024.10.18311.20241017T104455Z
Customer-name/Organization name: Assa Abloy
Screenshot (if applicable):
Code package (if applicable):
<confirmation-title
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
fieldLabel="Confirmation title"
granite:class="mycustomclass"
metaType="text-single"
name="confirmationTitle"
valueType="string">
<granite:data jcr:primaryType="nt:unstructured"
mycustomdata="123" />
</confirmation-title>

2 replies

daniel-strmecki
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
March 24, 2025

Here is an update that makes this even a bigger problem for my team. If a CF model contains any custom data attributes, then the CF using that model cannot be created in the new CF editor. This makes it impossible for us to use the same CF models in the old and new editor. 

The expected behavior would be that even though the custom data attributes cannot be used in the new CF editor right now, at least they should not cause errors when trying to create/edit CFs whose model contains custom data attributes.

I hope this gets addressed soon so we can use both editors in the transition phase.

 

BR,

Daniel

kautuk_sahni
Community Manager
Community Manager
March 27, 2025

@daniel-strmecki 

Thanks for proposing this idea.
This has been reported to the engineering under the internal reference SITES-30308. The product team will triage this request to verify feasibility based on the prioritization model. This post will be updated according to Jira's status.
Kautuk Sahni