CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (Github)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 5.0 Chiffon API

  • Project:
    • CakePHP
      • CakePHP
      • Authentication
      • Authorization
      • Chronos
      • Elastic Search
      • Queue
  • Version:
    • 5.0
      • 5.2
      • 5.1
      • 5.0
      • 4.6
      • 4.5
      • 4.4
      • 4.3
      • 4.2
      • 4.1
      • 4.0
      • 3.10
      • 3.9
      • 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

  • Global
  • Cake
    • Cache
    • Collection
    • Command
    • Console
    • Controller
    • Core
    • Database
    • Datasource
    • Error
    • Event
    • Form
    • Http
    • I18n
    • Log
    • Mailer
    • Network
    • ORM
    • Routing
    • TestSuite
    • Utility
    • Validation
    • View
      • Exception
      • Form
      • Helper
      • Widget

Class Cell

Cell base.

Abstract
Namespace: Cake\View

Constants

  • string
    TEMPLATE_FOLDER ¶
    'cell'

    Constant for folder name containing cell templates.

Property Summary

  • $View protected
    Cake\View\View

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

  • $_cache protected
    array|bool

    Caching setup.

  • $_eventClass protected
    string

    Default class name for new event objects.

  • $_eventManager protected
    Cake\Event\EventManagerInterface|null

    Instance of the Cake\Event\EventManager this object is using to dispatch inner events.

  • $_tableLocator protected
    Cake\ORM\Locator\LocatorInterface|null

    Table locator instance

  • $_validCellOptions protected
    array<string>

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

  • $_viewBuilder protected
    Cake\View\ViewBuilder|null

    The view builder instance being used.

  • $action protected
    string

    The cell's action to invoke.

  • $args protected
    array

    Arguments to pass to cell's action.

  • $defaultTable protected
    string|null

    This object's default table alias.

  • $request protected
    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 protected
    Cake\Http\Response

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

Method Summary

  • __construct() public

    Constructor.

  • __debugInfo() public

    Debug info.

  • __toString() public

    Magic method.

  • _cacheConfig() protected

    Generate the cache key to use for this cell.

  • createView() public

    Constructs the view class instance based on the current configuration.

  • dispatchEvent() public

    Wrapper for creating and dispatching events.

  • fetchTable() public

    Convenience method to get a table instance.

  • getEventManager() public

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

  • getTableLocator() public

    Gets the table locator.

  • initialize() public

    Initialization hook method.

  • render() public

    Render the cell.

  • set() public

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

  • setEventManager() public

    Returns the Cake\Event\EventManagerInterface instance for this object.

  • setTableLocator() public

    Sets the table locator.

  • viewBuilder() public

    Get the view builder being used.

Method Detail

__construct() ¶ public

__construct(Cake\Http\ServerRequest $request, Cake\Http\Response $response, Cake\Event\EventManagerInterface|null $eventManager = null, array<string, mixed> $cellOptions = [])

Constructor.

Parameters
Cake\Http\ServerRequest $request

The request to use in the cell.

Cake\Http\Response $response

The response to use in the cell.

Cake\Event\EventManagerInterface|null $eventManager optional

The eventManager to bind events to.

array<string, mixed> $cellOptions optional

Cell options to apply.

__debugInfo() ¶ public

__debugInfo(): array<string, mixed>

Debug info.

Returns
array<string, mixed>

__toString() ¶ public

__toString(): string

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
Throws
Error
Include error details for PHP 7 fatal errors.

_cacheConfig() ¶ protected

_cacheConfig(string $action, string|null $template = null): array

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

The name of the template to be rendered.

Returns
array

createView() ¶ public

createView(string|null $viewClass = null): Cake\View\View

Constructs the view class instance based on the current configuration.

Parameters
string|null $viewClass optional

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.

dispatchEvent() ¶ public

dispatchEvent(string $name, array $data = [], TSubject|null $subject = null): Cake\Event\EventInterface<TSubject>

Wrapper for creating and dispatching events.

Returns a dispatched event.

Parameters
string $name

Name of the event.

array $data optional

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

TSubject|null $subject optional

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

Returns
Cake\Event\EventInterface<TSubject>

fetchTable() ¶ public

fetchTable(string|null $alias = null, array<string, mixed> $options = []): Cake\ORM\Table

Convenience method to get a table instance.

Parameters
string|null $alias optional

The alias name you want to get. Should be in CamelCase format. If null then the value of $defaultTable property is used.

array<string, mixed> $options optional

The options you want to build the table with. If a table has already been loaded the registry options will be ignored.

Returns
Cake\ORM\Table
Throws
Cake\Core\Exception\CakeException
If `$alias` argument and `$defaultTable` property both are `null`.
See Also
\Cake\ORM\TableLocator::get()

getEventManager() ¶ public

getEventManager(): Cake\Event\EventManagerInterface

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\EventManagerInterface

getTableLocator() ¶ public

getTableLocator(): Cake\ORM\Locator\LocatorInterface

Gets the table locator.

Returns
Cake\ORM\Locator\LocatorInterface

initialize() ¶ public

initialize(): void

Initialization hook method.

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

Returns
void

render() ¶ public

render(string|null $template = null): string

Render the cell.

Parameters
string|null $template optional

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
Throws
Cake\View\Exception\MissingCellTemplateException|BadMethodCallException

set() ¶ public

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

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

Parameters
array|string $name

A string or an array of data.

mixed $value optional

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

setEventManager() ¶ public

setEventManager(Cake\Event\EventManagerInterface $eventManager): $this

Returns the Cake\Event\EventManagerInterface 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\EventManagerInterface $eventManager

the eventManager to set

Returns
$this

setTableLocator() ¶ public

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

Sets the table locator.

Parameters
Cake\ORM\Locator\LocatorInterface $tableLocator

LocatorInterface instance.

Returns
$this

viewBuilder() ¶ public

viewBuilder(): Cake\View\ViewBuilder

Get the view builder being used.

Returns
Cake\View\ViewBuilder

Property Detail

$View ¶ protected

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

Type
Cake\View\View

$_cache ¶ protected

Caching setup.

Type
array|bool

$_eventClass ¶ protected

Default class name for new event objects.

Type
string

$_eventManager ¶ protected

Instance of the Cake\Event\EventManager this object is using to dispatch inner events.

Type
Cake\Event\EventManagerInterface|null

$_tableLocator ¶ protected

Table locator instance

Type
Cake\ORM\Locator\LocatorInterface|null

$_validCellOptions ¶ protected

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

Type
array<string>

$_viewBuilder ¶ protected

The view builder instance being used.

Type
Cake\View\ViewBuilder|null

$action ¶ protected

The cell's action to invoke.

Type
string

$args ¶ protected

Arguments to pass to cell's action.

Type
array

$defaultTable ¶ protected

This object's default table alias.

Type
string|null

$request ¶ protected

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.

Type
Cake\Http\ServerRequest

$response ¶ protected

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

Type
Cake\Http\Response
OpenHub
Pingping
Linode
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (Github)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs