# cnBolt-Extensions-Designs A collection of design snippets for use in bolt satellite sites ## Install & Update Rebuild satis server: http://leeroy.condenastdigital.de/blue/organizations/jenkins/Tools%2FRebuild%20Satis%20Server/activity ## Logic Modules The folder `src`contains sub folders for service/controller modules. A module has to include a provider. Inside this Provider, a module can register it's own services, controllers or even twig extensions. Each module can be enabled inside the design extensions configuration file `design.cnd.yml`. **Sample Configuration** ``` modules: horoscope: false category-route: false load-more: false recommendations: true teaser-generators: true ``` ### Available Modules See detailed information in each modules Readme.md file. * **CategoryRoute** Provides an optional frontend controller that uses a record's category taxonomy as first url path element and redirects if needed. This controller extends the ThemedController and includes it's optional features (See ThemedRoute) * **Horoscope** Provides a service for special methods related to horoscopes as well as front, amp and api controllers to be used in your `routing.yml`. * **LoadMore** Provides a controller that generates a paginated list of teasers usable for "load more" ajax functions. * **Recommendations** A wrapper class available in twig that can retrieve a list of objects or teasers using one of several available modes. * **TeaserGenerators** A set of wrapper classes available in twig that create teasers from supported objects (internaly using cnd/basic teaser generator) and change certain teaser fields according depending on the generator used. * **ThemedRoute** Provides an optional frontend controller that can switch to al different zone and/or theme depending on request or routing parameters. ## Grunt After editing any .scss file you have to call `grunt deploy` in the base directory. This will create all themes. You can also select only one theme to built via parameters: ## Generate Module List A small php script can be run to create a markdown formatted list of all available components. It will dump a beautified list of templates in a design. Add a `info.md` file into a folder if you need more explanations of the modules in that folder. ``` php dump.php > MODULES.md ``` ## Path Definitions Extend the next available template from bolt, design extension brand or design extension default use this: ``` {% extends 'pages/portal/default.twig' %} ``` Extend just the template from the default design extend ist like this: ``` {% extends '@designs-default/pages/portal/default.twig' %} ``` ## Service The extension provides a service with some theme and design related methods used my some of the modules. ### Add Theme Add a theme folder and it's theme configuration to the active themes chain. This is a short-hand to `addThemeConfig` and `addThemeFolder`. ``` addTheme($theme, $themeRoot = self::DEFAULT_ROOT, $namespace = self::DEFAULT_NS) ``` ### Set Bolt Theme Set the current main theme name for Bolt. * **theme** (string) Theme and folder name ``` setThemeBolt($theme) ``` ### Add Theme Folder Add a new theme folder to to twig with highest priority. * **theme** (string) Theme and folder name * **themeRoot** (string) path to theme folder. Can be a Bolt filesystem path (ex: 'themes://') * **namespace** (string) Twig template Namespace ``` addThemeFolder($theme, $themeRoot = self::DEFAULT_ROOT, $namespace = self::DEFAULT_NS) ``` ### Add Theme Configuration Load a new `theme.yml` file inside a given template folder, overwriting or adding to the already loaded variables. * **theme** (string) Theme and folder name * **themeRoot** (string) path to theme folder. Can be a Bolt filesystem path (ex: 'themes://') ``` addThemeConfig($theme, $themeRoot = self::DEFAULT_ROOT) ``` ### Replace Theme Replace an already loaded theme folder at it's current position in the fallback chain of twig. **Note:** This function currently uses given themeroot for both, the searched and the replacement theme. * **searchTheme** (string) Theme and folder name to search * **replaceTheme** (string) Theme and folder name to replace it with * **themeRoot** (string) path to theme folder. Can be a Bolt filesystem path (ex: 'themes://') * **namespace** (string) Twig template Namespace ``` replaceThemeFolder($searchTheme, $replaceTheme, $themeroot = self::DEFAULT_ROOT, $namespace = self::DEFAULT_NS) ``` ## Frontend Controller This extension provides a new frontend controller that extends Bolt's basic frontend controller. It adds a couple of new feature and fixes for bugs in Bolt's controller. You can use it by redirecting frontend routes to `cnd-designs.front` instead of `controller.frontend`. The custom controllers inside the new modules above will also extend this controller. ### Fix - Support for all taxonomy notations Bolt's taxonomy route can only find taxonomies by using their key in taxonomy.yml. This override also supports slug/singular/slug/name/singular_name as Bolt already does with contenttypes. ### Feature - Redirect taxonomies to correct type if you want taxonomies to only use one specific type in their urls, you can redirect all supported urls of a taxonomy to a specific one. Add a key `force_taxonomytype` with the correct type as a string to your taxonomy inside `taxonomy.yml`. **Note** This will only redirect. It will not check if that new type notation is valid or supported. ### Recommendations define recommendations in designs.cnd.yml like this: ``` recommendations: default: mode: relationlist-global contenttype: configurations field: teasers length: 4 ```