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.6 Red Velvet API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 3.6
      • 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
      • Constraint
      • 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

Class Cell

Cell base.

Cake\View\Cell uses Cake\Event\EventDispatcherTrait , Cake\ORM\Locator\LocatorAwareTrait , Cake\Datasource\ModelAwareTrait , Cake\View\ViewVarsTrait
Abstract
Namespace: Cake\View
Location: View/Cell.php

Properties summary

  • $View public
    Cake\View\View

    Instance of the View created during rendering. Won't be set until after Cell::__toString() is called.

  • $_cache protected
    array|boolean
    Caching setup.
  • $_validCellOptions protected
    array

    List of valid options (constructor's fourth arguments) Override this property in subclasses to whitelist which options you want set as properties in your Cell.

  • $_validViewOptions protected
    array
    These properties can be set directly on Cell and passed to the View as options.
  • $action public
    string
    The cell's action to invoke.
  • $args public
    array
    Arguments to pass to cell's action.
  • $helpers public
    array
    The helpers this cell uses.
  • $plugin public
    string
    Automatically set to the name of a plugin.
  • $request public
    Cake\Http\ServerRequest

    An instance of a Cake\Http\ServerRequest object that contains information about the current request. This object contains all the information about a request and several methods for reading additional information about the request.

  • $response public
    Cake\Http\Response
    An instance of a Response object that contains information about the impending response
  • $template public
    string

    Name of the template that will be rendered. This property is inflected from the action name that was invoked.

Inherited Magic Properties

  • _validViewOptions

Inherited Properties

  • _eventClass, _eventManager _tableLocator _modelFactories, _modelType, modelClass _viewBuilder, viewClass, viewVars

Method Summary

  • __construct() public
    Constructor.
  • __debugInfo() public
    Debug info.
  • __toString() public
    Magic method.
  • _cacheConfig() protected
    Generate the cache key to use for this cell.
  • initialize() public
    Initialization hook method.
  • render() public
    Render the cell.

Method Detail

__construct() public ¶

__construct( Cake\Http\ServerRequest $request null , Cake\Http\Response $response null , Cake\Event\EventManager $eventManager null , array $cellOptions [] )

Constructor.

Parameters
Cake\Http\ServerRequest $request optional null
The request to use in the cell.
Cake\Http\Response $response optional null
The response to use in the cell.
Cake\Event\EventManager $eventManager optional null
The eventManager to bind events to.
array $cellOptions optional []
Cell options to apply.

__debugInfo() public ¶

__debugInfo( )

Debug info.

Returns
array

__toString() public ¶

__toString( )

Magic method.

Starts the rendering process when Cell is echoed.

Note This method will trigger an error when view rendering has a problem. This is because PHP will not allow a __toString() method to throw an exception.

Returns
string
Rendered cell
Throws
Error
Include error details for PHP 7 fatal errors.

_cacheConfig() protected ¶

_cacheConfig( string $action , string|null $template null )

Generate the cache key to use for this cell.

If the key is undefined, the cell class and action name will be used.

Parameters
string $action
The action invoked.
string|null $template optional null
The name of the template to be rendered.
Returns
array
The cache configuration.

initialize() public ¶

initialize( )

Initialization hook method.

Implement this method to avoid having to overwrite the constructor and calling parent::__construct().

render() public ¶

render( string|null $template null )

Render the cell.

Parameters
string|null $template optional null

Custom template name to render. If not provided (null), the last value will be used. This value is automatically set by CellTrait::cell().

Returns
string
The rendered cell.
Throws
Cake\View\Exception\MissingCellViewException
When a MissingTemplateException is raised during rendering.

Methods used from Cake\Event\EventDispatcherTrait

dispatchEvent() public ¶

dispatchEvent( string $name , array|null $data null , object|null $subject null )

Wrapper for creating and dispatching events.

Returns a dispatched event.

Parameters
string $name
Name of the event.
array|null $data optional null

Any value you wish to be transported with this event to it can be read by listeners.

object|null $subject optional null

The object that this event applies to ($this by default).

Returns
Cake\Event\Event

eventManager() public ¶

eventManager( Cake\Event\EventManager $eventManager null )

Returns the Cake\Event\EventManager manager instance for this object.

You can use this instance to register any new listeners or callbacks to the object events, or create your own events and trigger them at will.

Deprecated
3.5.0 Use getEventManager()/setEventManager() instead.
Parameters
Cake\Event\EventManager $eventManager optional null
the eventManager to set
Returns
Cake\Event\EventManager

getEventManager() public ¶

getEventManager( )

Returns the Cake\Event\EventManager manager instance for this object.

You can use this instance to register any new listeners or callbacks to the object events, or create your own events and trigger them at will.

Returns
Cake\Event\EventManager

setEventManager() public ¶

setEventManager( Cake\Event\EventManager $eventManager )

Returns the Cake\Event\EventManager manager instance for this object.

You can use this instance to register any new listeners or callbacks to the object events, or create your own events and trigger them at will.

Parameters
Cake\Event\EventManager $eventManager
the eventManager to set
Returns

$this

Methods used from Cake\ORM\Locator\LocatorAwareTrait

getTableLocator() public ¶

getTableLocator( )

Gets the table locator.

Returns
Cake\ORM\Locator\LocatorInterface

setTableLocator() public ¶

setTableLocator( Cake\ORM\Locator\LocatorInterface $tableLocator )

Sets the table locator.

Parameters
Cake\ORM\Locator\LocatorInterface $tableLocator
LocatorInterface instance.
Returns

$this

tableLocator() public ¶

tableLocator( Cake\ORM\Locator\LocatorInterface $tableLocator null )

Sets the table locator. If no parameters are passed, it will return the currently used locator.

Deprecated
3.5.0 Use getTableLocator()/setTableLocator() instead.
Parameters
Cake\ORM\Locator\LocatorInterface $tableLocator optional null
LocatorInterface instance.
Returns
Cake\ORM\Locator\LocatorInterface

Methods used from Cake\Datasource\ModelAwareTrait

_setModelClass() protected ¶

_setModelClass( string $name )

Set the modelClass and modelKey properties based on conventions.

If the properties are already set they will not be overwritten

Parameters
string $name
Class name.

getModelType() public ¶

getModelType( )

Get the model type to be used by this class

Returns
string

loadModel() public ¶

loadModel( string|null $modelClass null , string|null $modelType null )

Loads and constructs repository objects required by this object

Typically used to load ORM Table objects as required. Can also be used to load other types of repository objects your application uses.

If a repository provider does not return an object a MissingModelException will be thrown.

Parameters
string|null $modelClass optional null
Name of model class to load. Defaults to $this->modelClass
string|null $modelType optional null
The type of repository to load. Defaults to the modelType() value.
Returns
Cake\Datasource\RepositoryInterface
The model instance created.
Throws
Cake\Datasource\Exception\MissingModelException
If the model class cannot be found.
InvalidArgumentException
When using a type that has not been registered.
UnexpectedValueException
If no model type has been defined

modelFactory() public ¶

modelFactory( string $type , callable $factory )

Override a existing callable to generate repositories of a given type.

Parameters
string $type
The name of the repository type the factory function is for.
callable $factory
The factory function used to create instances.

modelType() public ¶

modelType( string|null $modelType null )

Set or get the model type to be used by this class

Deprecated
3.5.0 Use getModelType()/setModelType() instead.
Parameters
string|null $modelType optional null
The model type or null to retrieve the current
Returns
string|Cake\Datasource\ModelAwareTrait
$this

setModelType() public ¶

setModelType( string $modelType )

Set the model type to be used by this class

Parameters
string $modelType
The model type
Returns

$this

Methods used from Cake\View\ViewVarsTrait

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 ¶

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().

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

$View ¶

public Cake\View\View

Instance of the View created during rendering. Won't be set until after Cell::__toString() is called.

Deprecated
3.1.0 Use createView() instead.

$_cache ¶

protected array|boolean

Caching setup.

false

$_validCellOptions ¶

protected array

List of valid options (constructor's fourth arguments) Override this property in subclasses to whitelist which options you want set as properties in your Cell.

[]

$_validViewOptions ¶

protected array

These properties can be set directly on Cell and passed to the View as options.

See
Cake\View\View
[
    'viewPath'
]

$action ¶

public string

The cell's action to invoke.

$args ¶

public array

Arguments to pass to cell's action.

[]

$helpers ¶

public array

The helpers this cell uses.

This property is copied automatically when using the CellTrait

[]

$plugin ¶

public string

Automatically set to the name of a plugin.

$request ¶

public Cake\Http\ServerRequest

An instance of a Cake\Http\ServerRequest object that contains information about the current request. This object contains all the information about a request and several methods for reading additional information about the request.

$response ¶

public Cake\Http\Response

An instance of a Response object that contains information about the impending response

$template ¶

public string

Name of the template that will be rendered. This property is inflected from the action name that was invoked.

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