Interface BroadleafTagReplacementProcessor
- All Superinterfaces:
BroadleafProcessor
- All Known Implementing Classes:
AbstractBroadleafTagReplacementProcessor
A tag processor that's used to replace the tag that it was triggered on with a BroadleafTemplateModel. This allows implementations to
completely replace the element that invokes this with a brand new DOM (usually HTML).
For example, given an implementation of this tag that is invoked like this in the template:
<blc:output_javascript message="This is some Javascript"/>
A processor that implements this interface would replace that with a brand new model like:
<script type="text/javascript>
console.log("This is some Javscript");
</script>
This differs from the BroadleafModelModifierProcessor in that this BroadleafTagReplacementProcessor completely replaces the tag with a new model
while the BroadleafModelModifierProcessor is designed to augment the originally-written dom.
- Author:
- Jay Aisenbrey (cja769)
-
Field Summary
Fields inherited from interface org.broadleafcommerce.presentation.dialect.BroadleafProcessor
DEFAULT_PRECEDENCE, DEFAULT_PREFIX -
Method Summary
Modifier and TypeMethodDescriptiongetReplacementModel(String tagName, Map<String, String> tagAttributes, BroadleafTemplateContext context) booleanMethods inherited from interface org.broadleafcommerce.presentation.dialect.BroadleafProcessor
getName, getPrecedence, getPrefix
-
Method Details
-
replacementNeedsProcessing
boolean replacementNeedsProcessing()- Returns:
- true if the model returned has template logic that needs to reprocessed. This should return true if any of the elements added to
the resulting
BroadleafTemplateModelfrom the givenBroadleafTemplateContexthave additional expressions or includes that are template-processing specific (e.g. extra includes, addition of new variables in the tags, etc).
-
getReplacementModel
BroadleafTemplateModel getReplacementModel(String tagName, Map<String, String> tagAttributes, BroadleafTemplateContext context) - Parameters:
tagName- The name of the tag the event was triggered ontagAttributes- A map of String to String of all of the attributes on the tagcontext- TheBroadleafTemplateContextthat should be used to perform operations on the tag with- Returns:
- The
BroadleafTemplateModelthat should replace the tag that the event was triggered on
-