WapplerSystems / ws_slider

GNU General Public License v2.0
3 stars 2 forks source link

Tutorial new layout #24

Open harp71 opened 1 year ago

harp71 commented 1 year ago

Hi, is there documentation or a tutorial how to set up a second layout for the plugin. I noticed, that sections in Partials/Flexslider.html are ignored, while in Partials/Item/Flexslider.html they are recogniced. I commented in the youtube-video https://youtu.be/Kvfwmei7PWc also.

miko007 commented 5 months ago

in the code (Classes/Utility/TemplateLayout.php), the dropdown for layouts gets filled by this function:

    /**
     * Get template layouts defined in TsConfig
     *
     * @param $pageUid
     * @return array
     */
    protected function getTemplateLayoutsFromTsConfig($pageUid)
    {
        $templateLayouts = [];
        $pagesTsConfig = BackendUtility::getPagesTSconfig($pageUid);
        if (isset($pagesTsConfig['tx_wsslider.']['templateLayouts.']) && is_array($pagesTsConfig['tx_wsslider.']['templateLayouts.'])) {
            $templateLayoutsTemp = $pagesTsConfig['tx_wsslider.']['templateLayouts.'];
            foreach ($templateLayoutsTemp as $name => $value) {
                if (is_string($value)) {
                    $template = [$name, $value];
                    if (isset($templateLayoutsTemp[$name . '.']) && is_array($templateLayoutsTemp[$name . '.'])) {
                        $template[3] = $templateLayoutsTemp[$name . '.'];
                    }
                    $templateLayouts[] = $template;
                }
            }
        }
        return $templateLayouts;
    }

however, setting something like:

    tx_wsslider.templateLayouts {
        addItems {
            frontpage = Front Page
            carousel   = Carousel
        }
    }

in TSConfig has no effect. I guess, that feature is still missing.