Sulu Cmf: Relations as Select/Multi-Select - sulu

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

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 :-/

How to redirect struts action with dynamic parameter

I want to redirect action with parameter "id".
I used this code in struts.xml
<action name="register" class="com.framework.strust2.UserAffair">
<result name="success" type="redirectAction">
<param name="actionName">viewProfile</param>
<param name="id">${id}</param>
</result>
</action>
It works for action redirecting and parameter name id, but not parameter value ${id}. It only works with constant id, like;
<param name="id">1</param>
Though I searched the solution of my problem, there is nothing case that matches what I needed. Pls.
For passing the parameter with action you should have to define that variable in action and if you are using model driven approach then that parameter should be in pojo i.e
it is your struts.xml action configuration.
<action name="register" class="com.framework.strust2.UserAffair">
<result name="success" type="redirectAction">
<param name="actionName">viewProfile</param>
<param name="id">${id}</param>
</result>
</action>
so in you action class there should be variable sayaing id.
i.e
class UserAffair{
private int id;
//setter and getter
}
and if you are using model drivan then in your pojo there should be a variable saying id.
hope so this will help you a lot

Sulu as a Pagebuilder: block within block

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.

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.