src/control/CatalogueController.php
public function getViewer($action)
    {
        // Manually set templates should be dealt with by Controller::getViewer()
        if (isset($this->templates[$action]) && $this->templates[$action]
            || (isset($this->templates['index']) && $this->templates['index'])
            || $this->template
        ) {
            return parent::getViewer($action);
        }

        // Prepare action for template search
        if ($action == "index") {
            $action = "";
        } else {
            $action = '_' . $action;
        }

        $templates = array_merge(
            // Find templates by dataRecord
            SSViewer::get_templates_by_class(get_class($this->dataRecord), $action, "SilverStripe\\CMS\\Model\\SiteTree"),
            // Now get templates for sitetree
            SSViewer::get_templates_by_class(Page::singleton(), $action, "SilverStripe\\CMS\\Model\\SiteTree"),
            // Next, we need to add templates for all controllers
            SSViewer::get_templates_by_class(static::class, $action, "SilverStripe\\Control\\Controller"),
            // Fail-over to the same for the "index" action
            SSViewer::get_templates_by_class(get_class($this->dataRecord), "", "SilverStripe\\CMS\\Model\\SiteTree"),
            SSViewer::get_templates_by_class(static::class, "", "SilverStripe\\Control\\Controller")
        );

        return SSViewer::create($templates);
    }
public function getViewer($action)
    {
        // Manually set templates should be dealt with by Controller::getViewer()
        if (isset($this->templates[$action]) && $this->templates[$action]
            || (isset($this->templates['index']) && $this->templates['index'])
            || $this->template
        ) {
            return parent::getViewer($action);
        }

        // Prepare action for template search
        if ($action == "index") {
            $action = "";
        } else {
            $action = '_' . $action;
        }

        $templates = array_merge(
            // Find templates by dataRecord
            SSViewer::get_templates_by_class(get_class($this->dataRecord), $action, "SilverStripe\\CMS\\Model\\SiteTree"),
            // Now get templates for sitetree
            SSViewer::get_templates_by_class(Page::singleton(), $action, "SilverStripe\\CMS\\Model\\SiteTree"),
            // Next, we need to add templates for all controllers
            SSViewer::get_templates_by_class(static::class, $action, "SilverStripe\\Control\\Controller"),
            // Fail-over to the same for the "index" action
            SSViewer::get_templates_by_class(get_class($this->dataRecord), "", "SilverStripe\\CMS\\Model\\SiteTree"),
            SSViewer::get_templates_by_class(static::class, "", "SilverStripe\\Control\\Controller")
        );

        return SSViewer::create($templates);
    }
public function getViewer ( $ action ) { // Manually set templates should be dealt with by Controller::getViewer() if ( isset ( $ this -> templates [ $ action ] ) && $ this -> templates [ $ action ] || ( isset ( $ this -> templates [ 'index' ] ) && $ this -> templates [ 'index' ] ) || $ this -> template ) { return parent :: getViewer ( $ action ) ; } // Prepare action for template search if ( $ action == "index" ) { $ action = "" ; } else { $ action = '_' . $ action ; } $ templates = array_merge ( // Find templates by dataRecord SSViewer :: get_templates_by_class ( get_class ( $ this -> dataRecord ) , $ action , "SilverStripe\\CMS\\Model\\SiteTree" ) , // Now get templates for sitetree SSViewer :: get_templates_by_class ( Page :: singleton ( ) , $ action , "SilverStripe\\CMS\\Model\\SiteTree" ) , // Next, we need to add templates for all controllers SSViewer :: get_templates_by_class ( static :: class , $ action , "SilverStripe\\Control\\Controller" ) , // Fail-over to the same for the "index" action SSViewer :: get_templates_by_class ( get_class ( $ this -> dataRecord ) , "" , "SilverStripe\\CMS\\Model\\SiteTree" ) , SSViewer :: get_templates_by_class ( static :: class , "" , "SilverStripe\\Control\\Controller" ) ) ; return SSViewer :: create ( $ templates ) ; }
Overwrite default SSViewer call to get a custom
template list

@param $action string
@return SSViewer
Overwrite default SSViewer call to get a custom template list