Page 1 of 1

[Solved] How to define custom content blocks in CMSMS 2.0?

Posted: Mon Sep 28, 2015 10:53 pm
by Stom
I have previously used modules such as AdvancedContent to create custom content attributes in previous version of CMSMS. This was incredibly useful as it include options for checkboxes, color-pickers, images (with ajax upload field), dropdowns, select-multiples, etc.

Is there a way to do this with the stock CMSMS 2.0? Or is there a module that works with this version? I have tested AdvancedContent and it doesn't work sadly.

Re: How to define custom content blocks in CMSMS 2.0?

Posted: Tue Sep 29, 2015 1:47 am
by Stom
I found that CGContentUtils can do some of these features, although I can't seem to read it's attributes with CGSimpleSmarty.

I've created a true/false drop-down content block called "vertically-align" and it works if I have it directly in a template:

Code: Select all

{content_module module='CGContentUtils' tab="Style" block='center-vertically'}
But using CGSimpleSmarty to get the property in the template doesn't work, and causes the error below:

Code: Select all

{$valign="{cgsimple::get_page_content($node->alias,'center-vertically')}"}

Code: Select all

PHP Catchable fatal error:  Argument 4 passed to CGContentUtils::GetContentBlockFieldValue() must be an instance of ContentBase, boolean given, called in ./lib/classes/contenttypes/Content.inc.php on line 158 and defined in ./modules/CGContentUtils/CGContentUtils.module.php on line 657, referer: ./admin/moduleinterface.php?mact=CMSContentManager,m1_,admin_editcontent,0&_sk_=9955b28a0bde1f28&m1_content_id=36
Is there a way to get the CGContentUtils property? I'm using a similar set-up to this in order to show sub-pages as panels.

Edit: Issue seems to be a known bug, reported here:
http://dev.cmsmadesimple.org/bug/view/10633

Edit2: Found a fix after tinkering with it. One too many parameters were in the function call. Edit line 158 of ./lib/classes/contenttypes/Content.inc.php:

Code: Select all

$tmp =
$module->GetContentBlockFieldValue($blockName,$blockInfo['params'],$params,!$editing,$this);
To this:

Code: Select all

$tmp =
$module->GetContentBlockFieldValue($blockName,$blockInfo['params'],!$editing,$this);

Re: [Solved] How to define custom content blocks in CMSMS 2.

Posted: Tue Sep 29, 2015 8:04 am
by jce76350
from SVN rev 10235
/lib/classes/contenttypes/Content.inc.php
see modifications
and check if it works