Presenter

package Fuel
subpackage Core
category Core * @author Jelmer Schreuder

 Methods

Fetches an existing value from the template

__get(mixed $name) : mixed

Parameters

$name

mixed

Returns

mixed

Magic method, determines if a variable is set.

__isset(string $key) : boolean

isset($view->foo);

Parameters

$key

string

variable name

Returns

boolean

Sets and sanitizes a variable on the template

__set(string $key, mixed $value) : \Fuel\Core\Presenter

Parameters

$key

string

$value

mixed

Returns

Auto-render on toString

__toString() 

Magic method, unsets a given variable.

__unset(string $key) : void

unset($view->foo);

Parameters

$key

string

variable name

Executed after the view method

after() 

Change auto filter setting

auto_filter(null | bool $setting) : void | bool

Parameters

$setting

nullbool

change setting (bool) or get the current setting (null)

Returns

voidboolreturns current setting or nothing when it is changed

Executed before the view method

before() 

Assigns a value by reference.

bind(string $key, mixed $value, bool $filter) : \Fuel\Core\Presenter

The benefit of binding is that values can be altered without re-setting them. It is also possible to bind variables before they have values. Assigned values will be available as a variable within the view file:

$this->bind('ref', $bar);

fluent This method is part of a fluent interface and will return the same instance

Parameters

$key

string

variable name

$value

mixed

referenced variable

$filter

bool

Whether to filter the var on output

Returns

Factory for fetching the Presenter

forge(string $presenter, string $method, bool $auto_filter, string $view) : \Fuel\Core\Presenter

Parameters

$presenter

string

Presenter classname without View_ prefix or full classname

$method

string

Method to execute

$auto_filter

bool

Auto filter the view data

$view

string

View to associate with this presenter

Returns

Gets a variable from the template

get(null $key, null $default) : string

Parameters

$key

null

$default

null

Returns

string

Returns the View object associated with this Presenter

get_view() : \Fuel\Core\View

Returns

Add variables through method and after() and create template as a string

render() 

Sets a variable on the template

set(string $key, mixed $value, bool | null $filter) : \Fuel\Core\Presenter

fluent This method is part of a fluent interface and will return the same instance

Parameters

$key

string

$value

mixed

$filter

boolnull

Returns

The same as set(), except this defaults to not-encoding the variable on output.

set_safe(string $key, mixed $value) : \Fuel\Core\Presenter

$view->set_safe('foo', 'bar');

fluent This method is part of a fluent interface and will return the same instance

Parameters

$key

string

variable name or an array of variables

$value

mixed

value

Returns

Construct the View object

set_view($view) 

Parameters

$view

The default view method Should set all expected variables upon itself

view() 

__construct()

__construct($method, $auto_filter, $view) 

Parameters

$method

$auto_filter

$view

Returns the active request object.

request() : \Fuel\Core\Request

 Properties

 

<p>active request during Presenter creation for proper context</p>

$_active_request : \Fuel\Core\Request

 

<p>whether or not to use auto filtering</p>

$_auto_filter : bool

 

<p>method to execute when rendering</p>

$_method : string

 

<p>view name, after instantiation a View object</p>

$_view : string | \Fuel\Core\View

 

$ns_prefix

$ns_prefix