Pageworks / papertrain

Papertrain: a Craft CMS 3 framework
http://download.papertrain.io
MIT License
5 stars 2 forks source link

Update Template Name Method #90

Closed codewithkyle closed 5 years ago

codewithkyle commented 5 years ago

TransitionManager.ts

/**
 * Gets the first element with a `data-template` attribute.
 * If the element exists get the template name.
 * Return the templates name or our missing name value.
 * @returns string
 */
private getTemplateName(): string{
    let templateName = 'MISSING_TEMPLATE_NAME';

    const templateEl = html.querySelector('[data-template]');

    if(templateEl){
        templateName = templateEl.getAttribute('data-template');
    }

    return templateName;
}