FUEL CMS User Guide : Version 1.5.2


Fuel Pagevariables Model Class

Fuel_pagevariables_model is used for storing page variable data.

This class extends the Base_module_model class.

Properties Reference

Property Default Value Description
public
page_id none
honor_page_status none Will look at the pages published status as well
serialized_fields
array('value')
The "value" field is serialized using JSON
foreign_keys
array('page_id' => array
(
    [fuel] => fuel_pages_model
)
)
Add foreign key relationship to fuel_pages_model

Function Reference [+]

$this->fuel->pagevariables_model->list_items(['$limit'=NULL], ['$offset'=NULL], ['$col'='location'], ['$order'='desc'], ['$just_count'=FALSE])

Lists the page variables (not displayed in the CMS).

Returns

mixed If $just_count is true it will return an integer value. Otherwise it will return an array of data (optional)

Parameters

(int) $limit The limit value for the list data (optional)
(int) $offset The offset value for the list data (optional)
(string) $col The field name to order by (optional)
(string) $order The sorting order (optional)
(boolean) $just_count Determines whether the result is just an integer of the number of records or an array of data (optional)

$this->fuel->pagevariables_model->find_one_array('$where', ['$order_by'=NULL])

Overwrite: returns a single page variable record in an array format.

Returns

array

Parameters

(mixed) $where The where condition for the query
(string) $order_by The field name to order by (optional)

$this->fuel->pagevariables_model->find_one_by_location('$location', '$name', ['$lang'=NULL])

Returns a single page variable record in an array format based on the page location value.

Returns

array

Parameters

(string) $location The page location
(string) $name The variable name
(string) $lang The language associated with the variable (optional)

$this->fuel->pagevariables_model->find_all_by_location('$location', ['$lang'=NULL], ['$include_pagevars_object'=FALSE])

Returns a all page variable records in an array format based on the page location value.

Returns

array

Parameters

(string) $location The page location
(string) $lang The language associated with the variable (optional)
(boolean) $include_pagevars_object Determines whether to include the $pagevar object which includes all the page variables

$this->fuel->pagevariables_model->find_one_by_page_id('$page_id', '$name', ['$lang'=NULL])

Returns a single page variable record in an array format based on the pages ID value.

Returns

array

Parameters

(string) $page_id The page location
(string) $name The language associated with the variable (optional)
(boolean) $lang Determines whether to include the $pagevar object which includes all the page variables

$this->fuel->pagevariables_model->find_all_by_page_id('$page_id', ['$lang'=NULL])

Returns a all page variable records in an array format based on the page ID value.

Returns

array

Parameters

(string) $page_id The page location
(string) $lang The language associated with the variable (optional)

$this->fuel->pagevariables_model->cast('$val', '$type')

Casts and unserializes if necessary a single variable to it's proper type (int, boolean, array).

Returns

mixed

Parameters

(mixed) $val The data to be cast

$this->fuel->pagevariables_model->form_fields([$values=array()], [$related=array()])

Add FUEL specific changes to the form_fields method.

Returns

array An array to be used with the Form_builder class

Parameters

(array) $values Values of the form fields (optional)
(array) $related An array of related fields. This has been deprecated in favor of using has_many and belongs to relationships (deprecated)

$this->fuel->pagevariables_model->on_before_clean($values)

Model hook right before the data is cleaned. Determines type of variable.

Returns

array Returns the values to be cleaned

Parameters

(array) $values The values to be saved right the clean method is run

$this->fuel->pagevariables_model->determine_type($value)

Used by on_before_clean model hook to determine the type of variable (int, string, array).

Returns

string

Parameters

(array) $value The values to be determined

$this->fuel->pagevariables_model->_common_query(['$params'=NULL])

Common query that joins user page information with the page variable data.

Returns

void

Parameters

(mixed) $params parameter to pass to common query (optional)


Fuel Pagevariable Model Class

This class extends the Data_record class.

Function Reference [+]

$var->__toString()

Magic method that returns the value data if the object is echoed (e.g. $pagevar->h1 == $pagevar=>h1->value).

Returns

array

$var->get_value()

Returns the value of the page variable.

Returns

array


Fuel Pagevar Helper Class

Class used for accessing page variable field values easier.

Properties Reference

Property Default Value Description
protected
_vars N/A

Function Reference [+]

$var->__call('$method', $args)

Magic method for capturing method calls on the record object that don't exist.

Returns

array

Parameters

(object) $method method name
(array) $args arguments

$var->__set('$var', '$val')

Magic method to set variable object.

Returns

void

Parameters

(string) $var field name
(mixed) $val 

$var->__get('$var')

Magic method to return variable object.

Returns

mixed

Parameters

(string) $var field name