Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Public Attributes | Static Protected Attributes | List of all members
block_contents Class Reference

Public Member Functions

 __construct (array $attributes=null)
 Create new instance of block content. More...
 
 add_class ($class)
 Add html class to block. More...
 

Public Attributes

string $annotation = ''
 Any small print that should appear under the block to explain to the teacher about the block, for example 'This is a sticky block that was added in the system context. More...
 
string $arialabel = ''
 The label to use when the block does not, or will not have a visible title. More...
 
array $attributes
 An array of attribute => value pairs that are put on the outer div of this block. More...
 
int $blockinstanceid = 0
 If this is the contents of a real block, this should be set to the block_instance.id. More...
 
int $blockpositionid = 0
 If this is a real block instance, and there is a corresponding block_position.id for the block on this page, this should be set to that id. More...
 
int $collapsible = self::NOT_HIDEABLE
 One of the constants NOT_HIDEABLE, VISIBLE, HIDDEN. More...
 
string $content = ''
 HTML for the content.
 
array $controls = array()
 A (possibly empty) array of editing controls. More...
 
bool $dockable = false
 Set this to true if the block is dockable.
 
array $footer = ''
 An alternative to $content, it you want a list of things with optional icons.
 
int $skipid
 All the blocks (or things that look like blocks) printed on a page are given a unique number that can be used to construct id="" attributes. More...
 
string $title = ''
 The title of this block. More...
 
const HIDDEN = 2
 Used when the block has been collapsed.
 
const NOT_HIDEABLE = 0
 Used when the block cannot be collapsed.
 
const VISIBLE = 1
 Used when the block can be collapsed but currently is not.
 

Static Protected Attributes

static int $idcounter = 1
 Used to set $skipid.
 

Constructor & Destructor Documentation

◆ __construct()

block_contents::__construct ( array  $attributes = null)

Create new instance of block content.

Parameters
array$attributes

Member Function Documentation

◆ add_class()

block_contents::add_class (   $class)

Add html class to block.

Parameters
string$class

Member Data Documentation

◆ $annotation

string block_contents::$annotation = ''

Any small print that should appear under the block to explain to the teacher about the block, for example 'This is a sticky block that was added in the system context.

'

◆ $arialabel

string block_contents::$arialabel = ''

The label to use when the block does not, or will not have a visible title.

You should never set this as well as title... it will just be ignored.

◆ $attributes

array block_contents::$attributes

An array of attribute => value pairs that are put on the outer div of this block.

} and $classes attributes should be set separately.

◆ $blockinstanceid

int block_contents::$blockinstanceid = 0

If this is the contents of a real block, this should be set to the block_instance.id.

Otherwise this should be set to 0.

◆ $blockpositionid

int block_contents::$blockpositionid = 0

If this is a real block instance, and there is a corresponding block_position.id for the block on this page, this should be set to that id.

Otherwise it should be 0.

◆ $collapsible

int block_contents::$collapsible = self::NOT_HIDEABLE

One of the constants NOT_HIDEABLE, VISIBLE, HIDDEN.

Whether the user can toggle whether this block is visible.

◆ $controls

array block_contents::$controls = array()

A (possibly empty) array of editing controls.

Each element of this array should be an array('url' => $url, 'icon' => $icon, 'caption' => $caption). $icon is the icon name. Fed to $OUTPUT->image_url.

◆ $skipid

int block_contents::$skipid

All the blocks (or things that look like blocks) printed on a page are given a unique number that can be used to construct id="" attributes.

This is set automatically be the prepare() method. Do not try to set it manually.

◆ $title

string block_contents::$title = ''

The title of this block.

If this came from user input, it should already have had format_string() processing done on it. This will be output inside

tags. Please do not cause invalid XHTML.


The documentation for this class was generated from the following file: