Class ExecuteControllerDirective

java.lang.Object
org.craftercms.engine.freemarker.ExecuteControllerDirective
All Implemented Interfaces:
freemarker.template.TemplateDirectiveModel, freemarker.template.TemplateModel

public class ExecuteControllerDirective extends Object implements freemarker.template.TemplateDirectiveModel
Freemarker directive that allows to execute scripts/controllers from inside Freemarker templates. The directive receives a single parameter that is that path of the controller in the site.
Author:
avasquez
  • Field Details

    • PATH_PARAM_NAME

      public static final String PATH_PARAM_NAME
      See Also:
    • servletContext

      protected jakarta.servlet.ServletContext servletContext
  • Constructor Details

    • ExecuteControllerDirective

      public ExecuteControllerDirective(jakarta.servlet.ServletContext servletContext)
  • Method Details

    • execute

      public void execute(freemarker.core.Environment env, Map params, freemarker.template.TemplateModel[] loopVars, freemarker.template.TemplateDirectiveBody body) throws freemarker.template.TemplateException, IOException
      Specified by:
      execute in interface freemarker.template.TemplateDirectiveModel
      Throws:
      freemarker.template.TemplateException
      IOException
    • executeController

      protected void executeController(String path, freemarker.core.Environment env) throws freemarker.template.TemplateException
      Throws:
      freemarker.template.TemplateException
    • executeController

      protected void executeController(Script script, Map<String,Object> variables, freemarker.core.Environment env) throws freemarker.template.TemplateException
      Throws:
      freemarker.template.TemplateException
    • createScriptVariables

      protected Map<String,Object> createScriptVariables(freemarker.core.Environment env) throws freemarker.template.TemplateException
      Throws:
      freemarker.template.TemplateException
    • getPath

      protected String getPath(freemarker.template.TemplateModel pathParam, freemarker.core.Environment env) throws freemarker.template.TemplateException
      Throws:
      freemarker.template.TemplateException
    • getContentModel

      protected SiteItem getContentModel(freemarker.core.Environment env) throws freemarker.template.TemplateException
      Throws:
      freemarker.template.TemplateException
    • getTemplateModel

      protected Object getTemplateModel(freemarker.core.Environment env) throws freemarker.template.TemplateException
      Throws:
      freemarker.template.TemplateException