Interface BroadleafTagReplacementProcessor

All Superinterfaces:
BroadleafProcessor
All Known Implementing Classes:
AbstractBroadleafTagReplacementProcessor

public interface BroadleafTagReplacementProcessor extends BroadleafProcessor

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)
  • 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 BroadleafTemplateModel from the given BroadleafTemplateContext have 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 on
      tagAttributes - A map of String to String of all of the attributes on the tag
      context - The BroadleafTemplateContext that should be used to perform operations on the tag with
      Returns:
      The BroadleafTemplateModel that should replace the tag that the event was triggered on