Theme API

Nodejs application helpers are simple Ruby functions which accepts a 1 or more value, an optional argument, process those values and return a value to be displayed on the page.
Name Description
addHtmlAttribute(scope, attributeName, attributeValue) Adds a html attribute for element.
theme.addHtmlAttribute("html", "direction", "rtl");
addHtmlClass(scope, className) Adds html class for element.
theme.addHtmlClass("body", "app-default");
printHtmlAttributes(scope) Returns all scope attributes separated by the space.
<html <%= theme.printHtmlAttributes('html') %>>
printHtmlClasses(scope) Returns all scope classes separated by the space.
<body class='<%= theme.printHtmlClasses('body') %>'>
getIcon(path, classNames) Returns content of svg icon wrapped with .
<%- theme.getIcon("duotune/general/gen032.svg", "svg-icon fs-1" ) %>
setModeSwitch(flag) Sets mode switch value for current class instance.
theme.setModeSwitch(false);
isModeSwitchEnabled() Returns modeSwitchEnabled value.
<%if (theme.isModeSwitchEnabled()) { %>
setModeDefault(mode) Sets default mode value for current class instance.
theme.setModeDefault(false);
getModeDefault() Returns default theme mode.
<%= theme.getModeDefault() %>
setDirection(direction) Sets theme style direction RTL or LTR.
theme.setDirection(false);
getDirection() Returns current class instance direction value.
theme.getDirection()
isRtlDirection() Checks if style direction is RTL.
theme.isRtlDirection()
getAssetPath(path) Converts relative asset path to absolute path.
<img alt="Logo" src="<%= theme.getAssetPath(`media/logos/custom-1.png`) %>" class="h-60px h-lg-75px"/>
extendCssFilename(path) Verifies style mode and if it is rtl returns rtl exteted style file name.
theme.extendCssFilename("css/style.bundle.css")
getFavicon() Returns full path favicon from configuration.
<link rel="shortcut icon" href="<%= theme.getFavicon() %>" />
getFonts() Returns fonts array from configuration.
<% theme.getFonts().forEach(function(font){ %>
    <link rel="stylesheet" href="<%= font %>" />
<% }); %>
getGlobalAssets(type) Returns theme global js or css files array defined in theme configuration.
<!--begin::Global Stylesheets(mandatory)-->
    <% theme.getGlobalAssets("css").forEach(function(file){ %>
        <link rel="stylesheet" type="text/css" href="<%= file %>" />
    <% }); %>
    <!--end::Global Stylesheets-->
addVendors(vendors) Adds multiple new vendors to view.
theme.addVendors(['amcharts', 'amcharts-maps', 'amcharts-stock']);
addVendor(vendor) Adds single vendor to view.
theme.addVendor("datatables");
addJavascriptFile(file) Adds custom CSS file to view.
theme.addJavascriptFile("js/widgets.bundle.js");
addCssFile(file) Adds custom JS file to view.
theme.addJavascriptFile("css/style.bundle.css")
getJavascriptFiles() Returns array of all custom js files.
<% theme.getJavascriptFiles().forEach(function(file){ %>
  <script src="<%= theme.getAssetPath(file) %>"></script>
<% }); %>
getCssFiles() Returns array of all custom css files.
<% theme.getCssFiles().forEach(function(file){ %>
    <link rel="stylesheet" type="text/css" href="<%= theme.getAssetPath(file) %>" />
<% }); %>
getVendors(type) Returns array of vendor files.
<% theme.getVendors("css").forEach(function(file){ %>
    <link rel="stylesheet" type="text/css" href="<%= file %>" />
<% }); %>
getAttributeValue(scope, attributeName) Returns element attribtue value.
theme.getAttributeValue("body", "data-kt-app-layout")=="dark-header")
getPartialPath(path) Converts a relative partial path to absolute.
<%- include(theme.getPartialPath("partials/theme-mode/_init.ejs")); %>
getLayoutPath(path) Converts a relative layout partial path to absolute.
theme.getLayoutPath("systen")
getPageViewPath(folder, file) Helper function to get page view by page folder and file name.
theme.getPageViewPath("auth", "new-password")
Preview Get Help Buy Now