PHP Class Habari\Block

Inheritance: extends QueryRecord, implements IsContent, implements habari\FormStorage
Show file Open project: habari/system

Public Properties

Property Type Description
$_area
$_area_index
$_first
$_last

Public Methods

Method Description
__construct ( array $paramarray = [] ) Constructor for the Block class.
__get ( string $name ) : mixed Overrides QueryRecord __get to implement custom object properties
__isset ( string $name ) : boolean Overrides QueryRecord __isset, returns whether this Block has the named data. Falls back to QueryRecord's __isset.
__set ( string $name, mixed $value ) : mixed Overrides QueryRecord __set to implement custom object properties
__toString ( ) : string Convert this block into a string, just in case there isn't a template associated to this block type
add_to_area ( string $area, integer $order = null, string $scope = null ) Add this block to a particular area in the theme
content_type ( ) : array Return the content types that this object represents
default_fields ( ) : array Return the defined database columns for a Block.
delete ( ) Delete this block
fetch ( Theme $theme ) : string Render and return the block content
field_load ( string $key ) : mixed Load the form value from the block
field_save ( string $key, mixed $value ) Saves form fields that are tied to this block. Implements FormStorage.
get_form ( ) : FormUI Get the form used to update this block
insert ( ) : boolean | null Insert this block into the database
save_block ( FormUI $form ) : boolean Display a standard success message upon saving the form
unserialize_data ( ) Unserialize the stored block data
update ( ) : boolean | null Update this block in the database

Method Details

__construct() public method

Constructor for the Block class.
public __construct ( array $paramarray = [] )
$paramarray array an associative array of initial block field values.

__get() public method

Overrides QueryRecord __get to implement custom object properties
public __get ( string $name ) : mixed
$name string Name of property to return
return mixed The requested field value

__isset() public method

Overrides QueryRecord __isset, returns whether this Block has the named data. Falls back to QueryRecord's __isset.
public __isset ( string $name ) : boolean
$name string The name of the parameter
return boolean True if the value is set, false if not

__set() public method

Overrides QueryRecord __set to implement custom object properties
public __set ( string $name, mixed $value ) : mixed
$name string Name of property to return
$value mixed The value to set the property to
return mixed The value of the property

__toString() public method

Convert this block into a string, just in case there isn't a template associated to this block type
public __toString ( ) : string
return string The string representation of this content, as a bad fallback

add_to_area() public method

Add this block to a particular area in the theme
public add_to_area ( string $area, integer $order = null, string $scope = null )
$area string The name of the area to add to
$order integer The position of the block within the area
$scope string The scope id into which to add this block

content_type() public method

Return the content types that this object represents
See also: IsContent
public content_type ( ) : array
return array An array of strings representing the content type of this object

default_fields() public static method

Return the defined database columns for a Block.
public static default_fields ( ) : array
return array Array of columns in the Block table

delete() public method

Delete this block
public delete ( )

fetch() public method

Render and return the block content
public fetch ( Theme $theme ) : string
$theme Theme the theme object with which the block will be rendered
return string The rendered block content

field_load() public method

Load the form value from the block
public field_load ( string $key ) : mixed
$key string The name of the form field to load
return mixed The value of the block for the form

field_save() public method

Saves form fields that are tied to this block. Implements FormStorage.
public field_save ( string $key, mixed $value )
$key string The name of the form field to store.
$value mixed The value of the form field

get_form() public method

Get the form used to update this block
public get_form ( ) : FormUI
return FormUI The altered FormUI element that edits this block

insert() public method

Insert this block into the database
public insert ( ) : boolean | null
return boolean | null True on success, null if the action wasn't allowed

save_block() public method

Display a standard success message upon saving the form
public save_block ( FormUI $form ) : boolean
$form FormUI The form that will be saved
return boolean Returning false tells the form that the save was handled

unserialize_data() public method

Unserialize the stored block data
public unserialize_data ( )

update() public method

Update this block in the database
public update ( ) : boolean | null
return boolean | null True on success, null if the update isn't allowed

Property Details

$_area public property

public $_area

$_area_index public property

public $_area_index

$_first public property

public $_first

$_last public property

public $_last