Page 1 of 1

Some questions about "GetContentBlockFieldInput"

Posted: Thu Feb 11, 2016 2:03 pm
by Guido
As I'm diving further into module development for CMSMS, I'm playing with the idea of a content module. I'm studying the code from CGContentUtils and came accross 'GetContentBlockFieldInput'.

I looked it up in the API doc and would like to explain it in a really simple way to see if I get the workings:

So the system is parsing a template and comes accross this content_module tag. Is says hey, let's look for a block parameter. When it finds it, this gets passed as the first argument to the 'GetContentBlockFieldInput' function.

Now how are the other parameters (like value and params) passed in from this smarty call?

What is the 'adding' parameter? I see it is a flag that basically tells if I'm adding new content or editing existing, but what's the difference?

How can I work with the content object? Is it automatically available?

Re: Some questions about "GetContentBlockFieldInput"

Posted: Thu Feb 11, 2016 3:00 pm
by calguy1000
Guido wrote:So the system is parsing a template and comes accross this content_module tag. Is says hey, let's look for a block parameter. When it finds it, this gets passed as the first argument to the 'GetContentBlockFieldInput' function.

Now how are the other parameters (like value and params) passed in from this smarty call?
Answer is in the API docs

Re: Some questions about "GetContentBlockFieldInput"

Posted: Thu Feb 11, 2016 3:18 pm
by Guido
You mean this?

Code: Select all

Get an input field for a module generated content block type.

This method is called from the content edit form when a {content_module} tag is encountered.

This method can be overridden if the module is providing content block types to the CMSMS content objects.
Arguments
string $blockName

Content block name

mixed $value

Content block value

array $params

Associative array containing content block parameters

bool $adding

A flag indicating wether the content editor is in create mode (adding) vs. edit mod.

\ContentBase $content_obj

The content object being edited.

Response

mixed

Either an array with two elements (prompt, and xhtml element) or a string containing only the xhtml input element.
I read that, but don't understand it quite yet. Does params mean I can go:

Code: Select all

{content_module module="my_content_module" params="my_params"}
Or does it just mean ALL params in the smarty call?