You are viewing an old version of this page. View the current version.
Compare with Current
View Page History
« Previous
Version 17
Next »
cd my-light-modules
mkdir -p block-examples/blocks
mkdir -p block-examples/templates/blocks
mkdir block-examples/i18n
mkdir -p block-examples/decorations/stories-app/apps/
mkdir -p block-examples/templates/pages
class: info.magnolia.editor.block.stock.FieldSetBlockDefinition
templateId: block-examples:blocks/quote
fields:
quotation:
class: info.magnolia.ui.form.field.definition.TextFieldDefinition
rows: 3
citedPerson:
class: info.magnolia.ui.form.field.definition.TextFieldDefinition
templateScript: /block-examples/templates/blocks/quote.ftl
renderType: freemarker
[#if content.quotation?has_content]
${content.title!""}
${content.lead!""}
<blockquote>
<p>${cmsfn.decode(content).quotation}</p>
[#if content.citedPerson?has_content]<cite>${content.citedPerson}</cite>[/#if]
</blockquote>
[/#if]
blocks.quote.label=Quote
quote.quotation.label=Quote
quote.citedPerson.label=Cited person
blocks.quote.label=das Zitat
quote.quotation.label=das Zitat
quote.citedPerson.label=zitierte Person
subApps:
editor:
contentDefinition:
blocks:
- text
- image
- video
- externalLink
- quote
Add a title and lead text:
Add the url:
Add a new quote block:
Add the quote:
Click Save and Publish
renderType: freemarker
title: Block Page
templateScript: block-examples/templates/pages/block.ftl
[#assign testContent = cmsfn.contentByPath("/test", "stories") /]
<!DOCTYPE html>
<html xml:lang="en" lang="en" class="no-js">
<head>
[@cms.page /]
</head>
<body>
[#if testContent?hasContent]
[#assign blocks = cmsfn.children(testContent, "mgnl:block") /]
[#list blocks as block]
[@cms.block content=block /]
[/#list]
[/#if]
</body>
</html>
Click Next and then preview the page you just added. The quote you entered earlier should be displayed.
block-examples/
├── blocks
│ └── quote.yaml
├── decorations
│ └── stories-app
│ └── apps
│ └── stories.yaml
├── i18n
│ ├── example-blocks_de.properties
│ └── example-blocks_en.properties
└── templates
├── blocks
│ ├── quote.ftl
│ └── quote.yaml
└── pages
├── block.ftl
└── block.yaml