Sulu as a Pagebuilder: block within block - sulu

I want to use sulu as a pagebuilder.
A have a block with multiple elements in it. Now my next goal is to provide fields to sho a "Accordion-Script".
The Elements consist of
title (text_line)
content (text_editor)
I hoped that i could use a block in an other block like so:
<block name="contents"
default-type="editor"
minOccurs="0"
maxOccurs="200"
mandatory="true">
<meta>
<title lang="de">Artikelinhalt</title>
<title lang="en">Contents</title>
</meta>
<types>
<type name="tabs">
<meta>
<title lang="de">Tabs</title>
<title lang="en">Tabs</title>
</meta>
<properties>
<block name="tabContents"
default-type="editor"
minOccurs="0"
maxOccurs="200"
mandatory="true">
<types>
<type name="tabContent">
<meta>
<title lang="de">Texteditor</title>
<title lang="en">Text editor</title>
</meta>
<properties>
<property name="article" type="text_editor">
<meta>
<title lang="de">Inhalt</title>
<title lang="en">Content</title>
</meta>
<params>
<param name="table" value="true"/>
<param name="link" value="true"/>
<param name="paste_from_word" value="true"/>
<param name="height" value="400"/>
<param name="max_height" value="2000"/>
<!-- CKEditor Parameters examples: -->
<param name="extra_allowed_content" value="img(*)[*]; span(*)[*]; div(*)[*]; iframe(*)[*]; script(*)[*]" />
</params>
</property>
</properties>
</type>
</types>
</block>
</properties>
</type>
[...] here are my other type-attributes.
It does not work (backend is not loading the edit-page at all).
Is there a way to do that?
The Page should later be editable by the user and could have a structure like that:
- block
- text
- accordion
- text
- text
- text
- image

With Sulu 2.1.0 nested block support has been added to the core, see the release notes here https://sulu.io/blog/sulu-release-2-1-0-2-0-9

There is no support of nesting blocks in Sulu, but if I have a look at your example I would also say that it is not necessary to have nested blocks here.
It looks like you just want to group these blocks, therefore you could simply use a section:
<section name="contents">
<meta>
<title lang="de">Artikelinhalt</title>
<title lang="en">Contents</title>
</meta>
<properties>
<block name="tabContents"
default-type="editor"
minOccurs="0"
maxOccurs="200"
mandatory="true">
<types>
<type name="tabContent">
<meta>
<title lang="de">Texteditor</title>
<title lang="en">Text editor</title>
</meta>
<properties>
<property name="article" type="text_editor">
<meta>
<title lang="de">Inhalt</title>
<title lang="en">Content</title>
</meta>
<params>
<param name="table" value="true"/>
<param name="link" value="true"/>
<param name="paste_from_word" value="true"/>
<param name="height" value="400"/>
<param name="max_height" value="2000"/>
<!-- CKEditor Parameters examples: -->
<param name="extra_allowed_content"
value="img(*)[*]; span(*)[*]; div(*)[*]; iframe(*)[*]; script(*)[*]"/>
</params>
</property>
</properties>
</type>
</types>
</block>
</properties>
The sections are a pure visual help for the content manager, and won't have any effect on the structure passed to the twig template.

Related

Symfony ~ SULU - Property from "route" to "resource_locator"

In the exemple i made in the pictures, i change the property "url" of "Mathématique" page type from "route" type to "resource_locator" but this one is skipped in the hierarchy usage.
Do you have any idea about how to refresh URLs ?
<property name="url" type="resource_locator" mandatory="true">
<meta>
<title lang="en">Resourcelocator</title>
<title lang="de">Adresse</title>
</meta>
<tag name="sulu.rlp"/>
</property>

Sulu: How to display single_select as select instead of radio input?

is there a way to display a single_select in sulu admin as select box instead of a radio input?
I have a definition like this:
<property name="imagePosition" type="single_select" colspan="6">
<params>
<param name="values" type="collection">
<param name="left">
<meta>
<title lang="en">Left</title>
</meta>
</param>
<param name="right">
<meta>
<title lang="en">Right</title>
</meta>
</param>
<param name="top">
<meta>
<title lang="en">Top</title>
</meta>
</param>
<param name="bottom">
<meta>
<title lang="en">Bottom</title>
</meta>
</param>
<param name="afterHeadline">
<meta>
<title lang="en">After Headline</title>
</meta>
</param>
</param>
</params>
</property>
Maybe something like <param name="values" type="collection" input="select">?
Thx a lot!
Andreas
You can create you custom template for rendering single_select type and specify this template in SuluContentBundle configuration
sulu_content:
types:
single_select:
template: 'AppBundle:admin:single_select.html.twig'
More detailed instruction: Display single_select as select instead of radio input on Sulu admin
That is not implemented yet... So I am afraid to say that this is not working :-/

Sulu Cmf: Relations as Select/Multi-Select

Is there a way to define Relations (embed an entity) from an other type?
For example i have BlogPost and i have (already existing) other BlogPosts.
I want to have a Multi-Select to define related BlogPosts.
I didn't find it in the docs.
How can i accomplish this?
i guess smartcontent should do it.
could be defined in your template like:
<property name="pages" type="smart_content">
<meta>
<title lang="en">Smart Content</title>
</meta>
<params>
<param name="properties" type="collection">
<param name="title" value="title"/>
<param name="description" value="excerpt.description"/>
</param>
<param name="present_as" type="collection">
<param name="one">
<meta>
<title lang="en">One column</title>
</meta>
</param>
<param name="two">
<meta>
<title lang="en">Two column</title>
</meta>
</param>
</param>
</params>
</property>
also see the documentation:
http://docs.sulu.io/en/latest/book/creating-a-basic-website/using-smart-content.html

Adding a new aspect with a User property

Is it possible to add a property inside a new aspect that will hold a User from Alfresco's users ?
It will be used to input the User who's responsabile/authorizer of a document having a defined aspect.
The problem is that you've defined the same field twice. First as a d:text property and the second is an association.
In your model you've defined
<property name="txm:vacationPerson">
<title>Nom et prénom</title>
<type>d:text</type>
</property>
And as association you've defined:
<associations>
<association name="txm:vacationPerson">
<title>Assignee</title>
<source>
<mandatory>false</mandatory>
<many>false</many>
</source>
<target>
<class>cm:person</class>
<mandatory>false</mandatory>
<many>false</many>
</target>
</association>
</associations>
So it's rendering the first field as text and the second field isn't rendered anymore.
Remove the first d:text property or rename it.
Yes, and you may choose to use either an assocation or a property. Assuming you want users to pick the person manually, I'd go for the association since the default controls provided by share support picking a person out of the box.
Here is a sample aspect showing both - a property and an association to hold the user.
<aspect name="your:assignee">
<title>Your Aspect</title>
<properties>
<property name="your:assigedPersonUsername">
<title>Owner</title>
<type>d:text</type>
</property>
</properties>
<associations>
<association name="your:assignedPerson">
<title>Assignee</title>
<source>
<mandatory>false</mandatory>
<many>false</many>
</source>
<target>
<class>cm:person</class>
<mandatory>false</mandatory>
<many>false</many>
</target>
</association>
</associations>
</aspect>

Default route is matched instead specific route

<routes>
<www type="Zend_Controller_Router_Route_Hostname">
<route>www.domain.com</route>
<chains>
<index type="Zend_Controller_Router_Route">
<route></route>
<defaults module="default" controller="index" action="index" />
</index>
<community>
<route>community</route>
<defaults module="community" />
<chains>
<index type="Zend_Controller_Router_Route">
<route>:action/*</route>
<defaults controller="index" action="index" />
</index>
<member type="Zend_Controller_Router_Route_Regex">
<route>member/profile-(\d+)-(.+)</route>
<reverse>member/profile-%d-%s</reverse>
<map>
<id>1</id>
<nom>2</nom>
</map>
<defaults action="viewmember" />
</member>
</chains>
</community>
</chains>
</www>
As you can see, I use a route with :action/* in to cover the homepages and the basics actions on index controller.
domain.com/community/random_action => works good.
domain.com/community/ doesn't work. The whole homepage is displayed.
I checked, and the default route is matched.
I tried assemble() on route "www-community-index" and it gives well www.domain.com/community
I don't see from where comes the problem :(
The first thing you should check is if you deleted the default route.
The second one is....remember that the routes are checked in reverse order. This means that the most specific should be the first and the default the last one.