CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Team
    • Issues (Github)
    • YouTube Channel
    • Get Involved
    • Bakery
    • Featured Resources
    • Newsletter
    • Certification
    • My CakePHP
    • CakeFest
    • Facebook
    • Twitter
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 3.8 Red Velvet API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 3.8
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Namespaces

  • Cake
    • Auth
      • Storage
    • Cache
      • Engine
    • Collection
      • Iterator
    • Command
    • Console
      • Exception
    • Controller
      • Component
      • Exception
    • Core
      • Configure
        • Engine
      • Exception
      • Retry
    • Database
      • Driver
      • Exception
      • Expression
      • Schema
      • Statement
      • Type
    • Datasource
      • Exception
    • Error
      • Middleware
    • Event
      • Decorator
    • Filesystem
    • Form
    • Http
      • Client
        • Adapter
        • Auth
      • Cookie
      • Exception
      • Middleware
      • Session
    • I18n
      • Formatter
      • Middleware
      • Parser
    • Log
      • Engine
    • Mailer
      • Exception
      • Transport
    • Network
      • Exception
    • ORM
      • Association
      • Behavior
        • Translate
      • Exception
      • Locator
      • Rule
    • Routing
      • Exception
      • Filter
      • Middleware
      • Route
    • Shell
      • Helper
      • Task
    • TestSuite
      • Fixture
      • Stub
    • Utility
      • Exception
    • Validation
    • View
      • Exception
      • Form
      • Helper
      • Widget
  • None

Classes

  • AjaxView
  • Cell
  • Helper
  • HelperRegistry
  • JsonView
  • SerializedView
  • StringTemplate
  • View
  • ViewBlock
  • ViewBuilder
  • XmlView

Traits

  • CellTrait
  • StringTemplateTrait
  • ViewVarsTrait

Trait ViewVarsTrait

Provides the set() method for collecting template context.

Once collected context data can be passed to another object. This is done in Controller, TemplateTask and View for example.

Direct Users

  • Cake\Controller\Controller
  • Cake\Mailer\Email
  • Cake\View\Cell
  • Cake\View\View

Indirect Users

  • Cake\Controller\ErrorController
  • Cake\View\AjaxView
  • Cake\View\JsonView
  • Cake\View\SerializedView
  • Cake\View\XmlView
Namespace: Cake\View
Location: View/ViewVarsTrait.php

Properties summary

  • $_viewBuilder protected
    Cake\View\ViewBuilder
    The view builder instance being used.
  • $viewClass public
    string|null
    The name of default View class.
  • $viewVars public
    array
    Variables for the view.

Magic properties summary

  • $_validViewOptions public
    array

Method Summary

  • createView() public
    Constructs the view class instance based on the current configuration.
  • set() public
    Saves a variable or an associative array of variables for use inside a template.
  • viewBuilder() public
    Get the view builder being used.
  • viewOptions() public deprecated

    Get/Set valid view options in the object's _validViewOptions property. The property is created as an empty array if it is not set. If called without any parameters it will return the current list of valid view options. See createView().

Method Detail

createView() public ¶

createView( string|null $viewClass = null )

Constructs the view class instance based on the current configuration.

Parameters
string|null $viewClass optional null
Optional namespaced class name of the View class to instantiate.
Returns
Cake\View\View
Throws
Cake\View\Exception\MissingViewException
If view class was not found.

set() public ¶

set( string|array $name , mixed $value = null )

Saves a variable or an associative array of variables for use inside a template.

Parameters
string|array $name
A string or an array of data.
mixed $value optional null

Value in case $name is a string (which then works as the key). Unused if $name is an associative array, otherwise serves as the values to $name's keys.

Returns

$this

viewBuilder() public ¶

viewBuilder( )

Get the view builder being used.

Returns
Cake\View\ViewBuilder

viewOptions() public deprecated ¶

viewOptions( string|array|null $options = null , boolean $merge = true )

Get/Set valid view options in the object's _validViewOptions property. The property is created as an empty array if it is not set. If called without any parameters it will return the current list of valid view options. See createView().

Deprecated
3.7.0 Use ViewBuilder::setOptions() or any one of it's setter methods instead.
Parameters
string|array|null $options optional null
string or array of string to be appended to _validViewOptions.
boolean $merge optional true

Whether to merge with or override existing valid View options. Defaults to true.

Returns
array
The updated view options as an array.

Properties detail

$_viewBuilder ¶

protected Cake\View\ViewBuilder

The view builder instance being used.

$viewClass ¶

public string|null

The name of default View class.

Deprecated
3.1.0 Use $this->viewBuilder()->getClassName()/$this->viewBuilder()->setClassName() instead.

$viewVars ¶

public array

Variables for the view.

Deprecated: This property will be removed in 4.x. Inside controller context use $this->set() instead, also see $this->viewBuilder()->getVar(). In view context it will be a protected property View::$viewVars.

[]

Magic properties detail

$_validViewOptions ¶

public array
Follow @CakePHP
#IRC
OpenHub
Rackspace
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Logos & Trademarks
  • Community
  • Team
  • Issues (Github)
  • YouTube Channel
  • Get Involved
  • Bakery
  • Featured Resources
  • Newsletter
  • Certification
  • My CakePHP
  • CakeFest
  • Facebook
  • Twitter
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs