Bolt Extension Structured Content ====================== Extension that allows to add a structured content ( JSON ) to a field in Bolt v3.x Extension ## Installation 1. Add the repository cnd-imageupload to the extensions/composer.json ``` "repositories": { "packagist": false, "bolt": { "type": "composer", "url": "https://extensions.bolt.cm/satis/" }, "cnd-imageupload": { "type": "git", "url": "https://github.com/CondeNastDigital/cnBolt-Extensions-Imageupload.git" } }, ``` 2. Trigger the composer installation ``` composer require cnd/bolt-structured-content composer install ``` ## Configuration 1. Add a field of type structuredfield to a content type e.g. ``` pages: name: Pages singular_name: Page fields: title: type: text class: large group: content slug: type: slug uses: title image: type: image teaser: type: html height: 150px body: type: html height: 300px # Structured Conten Field structuredcontent: type: structuredcontentfield height: 400px blocks: [Image, Heading, Text, List, Video, Quote] # Structured Conten Field template: type: templateselect filter: '*.twig' taxonomy: [ groups ] recordsperpage: 100 ``` ## Usage The plugin provides a filter called scrender. With its help, one can convert the JSON comming form the database, to a nice HTML ( other formats will later also be supported ) Inside a structured content template, you will have access to these variables in addition to your context: * **section** the content data to render * **section_index** zero based index of this section in the section list * **section_config** structured content configuration of this section type as found in `structuredcontent.cnd.yml` * **section_blockconfig** field configuration of this section as found in `extend` block of current section type in `contenttypes.yml` * **section_options** Optional array of options as given when calling `scrender`. (Should at least contain `field: record.contenttype.field.`) * **section_state** A class with custom data inside that will be shared among all sections * **section_first** boolean indicates if this is the first section * **section_last** boolean indicates if this is the last section