\CGContentUtilsContentBlock

A class to describe a single content block for use in page templates.

Instances of this class are immutable.

Acceptable Attributes by block type:

  • textinput
    • length - (int) The size of the text area.
    • maxlength - (int) The maximum amount of text permitted.
  • date
    • min - (string) The minimum date
    • max - (string) The maximum date
  • number
    • min - (float) The minimum number
    • max - (float) The maximum number
    • step - (float) The amount to step between min and max.
  • textarea
    • rows - (int) The number of rows in the textarea.
    • cols - (int) The number of columns in the textarea.
    • wysiwyg - (bool) Whether to allow the WYSIWYG in this textarea.
  • statictext
    • fieldtext - (string) The static text to display. HTML is not permitted. Newlines will be substituted with
  • dropdown
    • dropdown - (string) Text to define the options for the dropdown. One option per line. Values and labels should be separated by a | character. A smarty template is permitted.
  • dropdown_udt
    • udt - (string) The name of a UDT/simple_plugin to use for generating the options.
  • gcb_selector
    • gcb_prefix - (string) A prefix to use for filtering GCB's.
  • multiselect
    • options - (string) Text to define the options for the dropdown. One option per line. Values and labels should be separated by a | character. A smarty template is permitted.
    • storagedelimiter - (string)
  • sortable_list
    • options - (string) Text to define the options for the dropdown. One option per line. Values and labels should be separated by a | character. A smarty template is permitted.
    • sortable_maxitems - (int) The maxiumum number of items that can be selected.
  • checkbox
    • value - (string) The value for the checkbox.
  • radiobuttons
    • options - (string) Text to define the options for the dropdown. One option per line. Values and labels should be separated by a | character. A smarty template is permitted.
  • file_selector
    • dir - (string) The name of a directory (relative to the CMSMS uploads direcotry) to read files from.
    • excludeprefix - (string) Optionally exclude files or paths with this prefix.
    • filetypes - (string)
    • recurse - (bool) Optionally recurse into sub directories.
    • sortfiles - (bool) Sort files by their natural name
  • advpageselector
    • adv_start - (int) The page id of the start page.
    • adv_navhidden - (bool) Whether or not to include pages that are hidden from the navigation.

Summary

Methods
Properties
Constants
with_name()
with_type()
with_prompt()
with_value()
with_attrib()
$id
$type
$name
$prompt
$attribs
$value
types
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Constants

types

types

A constant list of the known block types.

Properties

$id

$id : integer

The unique block id.

Type

integer

$type

$type : string

The block type

Type

string

$name

$name : string

The unique block name

Type

string

$prompt

$prompt : string

A required prompt for the block.

Type

string

$attribs

$attribs : array

An associative array of attributes for this block.

Type

array

$value

$value : string

Type

string

Methods

with_name()

with_name(string  $name) : \CGContentUtils\ContentBlock

Set a name into a content block.

There is no validation to the content of the string provided.

Parameters

string $name

the new content blockn name.

Returns

\CGContentUtils\ContentBlock

The new content block.

with_type()

with_type(string  $type) : \CGContentUtils\ContentBlock

Set the type of a content block.

Parameters

string $type

A valid type name

Returns

\CGContentUtils\ContentBlock

the new content block

with_prompt()

with_prompt(string  $prompt) : \CGContentUtils\ContentBlock

Set the prompt for a content block

Parameters

string $prompt

A non empty prompts.

Returns

\CGContentUtils\ContentBlock

the new content block

with_value()

with_value(string  $value) : \CGContentUtils\ContentBlock

Set the defalt value for a content block

Parameters

string $value

Returns

\CGContentUtils\ContentBlock

the new content block

with_attrib()

with_attrib(string  $key, mixed  $val) : \CGContentUtils\ContentBlock

Set a content block attribute

Parameters

string $key

The atrribute key

mixed $val

A value for the attribute. If the value is null, then the attribute is unset. Otherwise it is copied without validation.

Returns

\CGContentUtils\ContentBlock