Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Dynamic "content blocks" possible in SilverStripe?


Go to End


14 Posts   7582 Views

Avatar
jand

Community Member, 30 Posts

17 December 2011 at 12:11am

Hi,
I wonder if it is possible to have dynamically added blocks of content in the SilverStripe edit page panel. So for example if a PageType has the fields "Title", "Short Text" and "Long Text" -> then you could click on an extra button "add block". There you may select further fields like "Video", "Slide Show", "Contact Form" or similar. Just like for example concrete5 or typo3 do it.

I know that the structure of SilverStripe is different from these CMS but is there a module or idea on how to implement this in SilverStripe?

thanks
Jan

Avatar
Juanitou

Community Member, 323 Posts

17 December 2011 at 4:04am

Hi Jan,

You are maybe looking for Widgets:
http://doc.silverstripe.org/sapphire/en/topics/widgets
http://www.silverstripe.org/widgets/

Hope it helps,
Juan

Avatar
jand

Community Member, 30 Posts

23 December 2011 at 6:29am

Hi Juan,
thanks for your hint … well, it's not exactly what I meant. I think these widgets are more for side bars and similar. You add a special functionality to a side bar, but can't add multiple bits of the same type (e.g. a 2 column text block) to the content area.

If anyone knows the admin panel of concrete5 or typo3 … this is more what I mean.

Avatar
swaiba

Forum Moderator, 1899 Posts

23 December 2011 at 7:14am

Edited: 23/12/2011 7:15am

Hi,

I don't know of "admin panel of concrete5 or typo3" but...

I think these widgets are more for side bars and similar

this is the impression that is given, but not true.

can't add multiple bits of the same type (e.g. a 2 column text block) to the content area

yes you can you just add more widget areas and change the layout of the template, if needed also change the WidgetArea template for new widget areas. It doesn't come out of the box, but it's not that hard to do almost anything with it.

Also since you are posting in silverstirpe forum it might be best to add screen shots or give more accurate description than "admin panel of concrete5 or typo3" to get more help.

Avatar
jand

Community Member, 30 Posts

23 December 2011 at 11:10am

Hi,
I had a closer look at the widgets now and I think you are absolutely right: With some amendments they could easily provide the functions I am looking for. There are only two things that are worrying me:
- Versioning: It seems that widget content (and the whole widget list) are not considered in the page versions (at least the basic installation shows no contents for widgets in the page history)
- Language Versions: In the basic installation my widgets were not translatable.

PS
Sorry for the missing screens, I attached a three step example from concrete5 now

Avatar
swaiba

Forum Moderator, 1899 Posts

23 December 2011 at 10:10pm

Language Versions: In the basic installation my widgets were not translatable.

You'll need this...

Object::add_extension('Widget', 'Translatable');
Object::add_extension('WidgetArea', 'Translatable');

Versioning: It seems that widget content (and the whole widget list) are not considered in the page versions (at least the basic installation shows no contents for widgets in the page history)

Good point - I've noticed that, but never looked into it, I'd imagine it was like the above, but with "Versioned"...

Object::add_extension('Widget', 'Versioned');
Object::add_extension('WidgetArea', 'Versioned');

Maybe you'll try the versioned thing? and please report back with your results.

With the screen shots I've either seen someone do something like that in SS or it was screenies of the same CMS... a simple search yeilded these...

http://www.silverstripe.org/general-questions/show/5725?start=8#post276997
http://www.sspaste.com/paste/show/4e57c259398d4

Avatar
swaiba

Forum Moderator, 1899 Posts

16 January 2012 at 5:13am

Hi again, I'd like to add this link that has come up on the dev list...

https://github.com/dodat/silverstripe-page-elements

Also I discussed this with Ingo at the London Meetup recently and Silverstripe don't even use widgets, just a HasManyCTF and put the content blocks on there.

Avatar
jand

Community Member, 30 Posts

21 January 2012 at 4:44am

Hi, thanks, we'll play around with the various options when the next project with this requirements comes up (for now we just "solved" it with a bunch of text fields)

Go to Top