Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Templating #2

Open
wants to merge 1 commit into
base: feature/01-webspaces
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"scheb/2fa-trusted-device": "^7.2",
"stof/doctrine-extensions-bundle": "^1.11",
"sulu/sulu": "~2.6.6",
"sulu/web-twig": "^2.6",
"symfony/config": "^7.1",
"symfony/dotenv": "^7.1",
"symfony/flex": "^1.17 || ^2.0",
Expand Down
61 changes: 60 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 29 additions & 6 deletions config/image-formats.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,39 @@

<!-- See: http://docs.sulu.io/en/latest/book/image-formats.html how to define image-formats -->

<!--
<format key="300x">
<format key="200x200">
<meta>
<title lang="en">Example Image</title>
<title lang="de">Beispielbild</title>
<title lang="en">Avatar</title>
<title lang="de">Avatar</title>
</meta>

<scale x="300"/>
<scale x="200" y="200"/>
</format>

<format key="300x100">
<meta>
<title lang="en">Thumbnail</title>
<title lang="de">Thumbnail</title>
</meta>

<scale x="300" y="100"/>
</format>

<format key="600x">
<meta>
<title lang="en">Text Block</title>
<title lang="de">Textblock</title>
</meta>
<scale x="600"/>
</format>

<format key="1200x">
<meta>
<title lang="en">Gallery</title>
<title lang="de">Galerie</title>
</meta>
<scale x="1200"/>
</format>
-->

<!--
Render an image from the media_selection in a specific format the following way:
Expand Down
9 changes: 9 additions & 0 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,12 @@ services:

# add more service definitions when explicit configuration is needed
# please note that last definitions always *replace* previous ones

Sulu\Twig\Extensions\ImageExtension:
arguments:
$defaultAttributes:
loading: 'lazy'
$defaultAdditionalTypes:
webp: 'image/webp'
$aspectRatio: true
$imageFormatConfiguration: '%sulu_media.image.formats%'
34 changes: 34 additions & 0 deletions config/templates/blocks/gallery.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" ?>
<template xmlns="http://schemas.sulu.io/template/template"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schemas.sulu.io/template/template http://schemas.sulu.io/template/template-1.0.xsd">

<key>gallery</key>

<meta>
<title lang="en">Image gallery</title>
<title lang="de">Bildergalerie</title>
</meta>

<properties>
<property name="title" type="text_line">
<meta>
<title lang="en">Title</title>
<title lang="de">Titel</title>
</meta>
</property>

<property name="images" type="media_selection">
<meta>
<title lang="en">Images</title>
<title lang="de">Bilder</title>
</meta>

<params>
<param name="types" value="image"/>
</params>

<tag name="sulu.block_preview" priority="512"/>
</property>
</properties>
</template>
52 changes: 52 additions & 0 deletions config/templates/blocks/text_image.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" ?>
<template xmlns="http://schemas.sulu.io/template/template"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schemas.sulu.io/template/template http://schemas.sulu.io/template/template-1.0.xsd">

<key>text_image</key>

<meta>
<title lang="de">Text mit Bild</title>
<title lang="en">Text with image</title>
</meta>

<properties>
<property name="title" type="text_line">
<meta>
<title lang="en">Title</title>
<title lang="de">Titel</title>
</meta>

<tag name="sulu.block_preview" priority="512"/>
</property>

<property name="image" type="single_media_selection">
<meta>
<title lang="en">Image</title>
<title lang="de">Bild</title>
</meta>

<tag name="sulu.block_preview" priority="1024"/>

<params>
<param name="types" value="image,video"/>

<param name="displayOptions" type="collection">
<param name="left" value="true"/>
<param name="right" value="true"/>
</param>

<param name="defaultDisplayOption" value="right"/>
</params>
</property>

<property name="article" type="text_editor">
<meta>
<title lang="en">Article</title>
<title lang="de">Artikel</title>
</meta>

<tag name="sulu.block_preview" priority="256"/>
</property>
</properties>
</template>
148 changes: 144 additions & 4 deletions config/templates/pages/default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<title lang="en">Title</title>
<title lang="de">Titel</title>
</meta>

<params>
<param name="headline" value="true"/>
</params>
Expand All @@ -36,11 +37,150 @@
<tag name="sulu.rlp"/>
</property>

<property name="article" type="text_editor">
<section name="header">
<meta>
<title lang="en">Article</title>
<title lang="de">Artikel</title>
<title lang="en">Header</title>
<title lang="de">Header</title>
</meta>
</property>
<properties>
<property name="headline" type="text_line">
<meta>
<title lang="en">Headline</title>
<title lang="de">Headline</title>
</meta>
</property>

<property name="header_image" type="single_media_selection">
<meta>
<title lang="en">Header Image</title>
<title lang="de">Header Bild</title>
</meta>
<params>
<param name="types" value="image"/>
</params>
</property>

<property name="introduction" type="text_editor">
<meta>
<title lang="en">Introduction</title>
<title lang="de">Einleitung</title>
</meta>
</property>
</properties>
</section>

<section name="content">
<meta>
<title lang="en">Content</title>
<title lang="de">Inhalt</title>
</meta>
<properties>
<block name="blocks" default-type="text_image">
<types>
<type ref="text_image"/>

<type ref="gallery"/>

<type name="faq">
<meta>
<title lang="en">FAQ</title>
<title lang="de">FAQ</title>
</meta>

<properties>
<property name="title" type="text_line">
<meta>
<title lang="en">Title</title>
<title lang="de">Titel</title>
</meta>
</property>

<property name="opening" type="text_editor">
<meta>
<title lang="en">Article</title>
<title lang="de">Artikel</title>
</meta>
</property>

<block name="questions">
<types>
<type name="question">
<properties>
<property name="question" type="text_line">
<meta>
<title lang="en">Question</title>
<title lang="de">Frage</title>
</meta>
</property>

<property name="answer" type="text_area">
<meta>
<title lang="en">Answer</title>
<title lang="de">Antwort</title>
</meta>
</property>
</properties>
</type>
</types>
</block>
</properties>
</type>

<type name="venue">
<meta>
<title lang="en">Venue</title>
<title lang="de">Veranstaltungsort</title>
</meta>

<properties>
<property name="title" type="text_line">
<meta>
<title lang="en">Title</title>
<title lang="de">Titel</title>
</meta>
</property>

<property name="image_map" type="image_map" default-type="hotspot">
<meta>
<title lang="en">Map</title>
<title lang="de">Map</title>
</meta>

<types>
<type name="hotspot">
<meta>
<title lang="en">Hotspot</title>
<title lang="de">Hotspot</title>
</meta>
<properties>
<property name="title" type="text_line">
<meta>
<title lang="en">Title</title>
<title lang="de">Titel</title>
</meta>
</property>
<property name="description" type="text_area">
<meta>
<title lang="en">Description</title>
<title lang="de">Beschreibung</title>
</meta>
</property>
<property name="link" type="link">
<meta>
<title lang="en">Link</title>
<title lang="de">Link</title>
</meta>
</property>
</properties>
</type>
</types>
</property>
</properties>
</type>
</types>
</block>
</properties>
</section>

</properties>
</template>
Loading