Cell base.
string
'cell'
\Cake\View\View
Instance of the View created during rendering. Won't be set until after Cell::__toString()/render() is called.
array|bool
Caching setup.
string
Default class name for new event objects.
\Cake\Event\EventManagerInterface
Instance of the Cake\Event\EventManager this object is using to dispatch inner events.
(callable|\Cake\Datasource\Locator\LocatorInterface)[]
A list of overridden model factory functions.
string
The model type to use.
\Cake\ORM\Locator\LocatorInterface|null
Table locator instance
array
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.
\Cake\View\ViewBuilder|null
The view builder instance being used.
string
The cell's action to invoke.
array
Arguments to pass to cell's action.
string|null
This object's primary model class name. Should be a plural form.
\Cake\Http\ServerRequest
An instance of a Cake\Http\ServerRequest object that contains information about the current request.
\Cake\Http\Response
An instance of a Response object that contains information about the impending response
__construct(\Cake\Http\ServerRequest $request, \Cake\Http\Response $response, ?\Cake\Event\EventManagerInterface $eventManager, array $cellOptions)
Constructor.
\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
$eventManager optional The eventManager to bind events to.
array
$cellOptions optional Cell options to apply.
__debugInfo()
Debug info.
array
__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.
string
Rendered cell
Error
_cacheConfig(string $action, ?string $template)
Generate the cache key to use for this cell.
If the key is undefined, the cell class and action name will be used.
string
$action The action invoked.
string|null
$template optional The name of the template to be rendered.
array
The cache configuration.
_setModelClass(string $name)
Set the modelClass property based on conventions.
If the property is already set it will not be overwritten
string
$name Class name.
createView(?string $viewClass)
Constructs the view class instance based on the current configuration.
string|null
$viewClass optional Optional namespaced class name of the View class to instantiate.
\Cake\View\View
Cake\View\Exception\MissingViewException
dispatchEvent(string $name, ?array $data, ?object $subject)
Wrapper for creating and dispatching events.
Returns a dispatched event.
string
$name Name of the event.
array|null
$data optional Any value you wish to be transported with this event to it can be read by listeners.
object|null
$subject optional The object that this event applies to ($this by default).
\Cake\Event\EventInterface
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.
\Cake\Event\EventManagerInterface
getModelType()
Get the model type to be used by this class
string
getTableLocator()
Gets the table locator.
\Cake\ORM\Locator\LocatorInterface
initialize()
Initialization hook method.
Implement this method to avoid having to overwrite the constructor and calling parent::__construct().
loadModel(?string $modelClass, ?string $modelType)
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.
string|null
$modelClass optional Name of model class to load. Defaults to $this->modelClass. The name can be an alias like 'Post'
or FQCN like App\Model\Table\PostsTable::class
.
string|null
$modelType optional The type of repository to load. Defaults to the getModelType() value.
\Cake\Datasource\RepositoryInterface
The model instance created.
Cake\Datasource\Exception\MissingModelException
UnexpectedValueException
modelFactory(string $type, mixed $factory)
Override a existing callable to generate repositories of a given type.
string
$type The name of the repository type the factory function is for.
callable|\Cake\Datasource\Locator\LocatorInterface
$factory The factory function used to create instances.
render(?string $template)
Render the cell.
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()
.
string
The rendered cell.
Cake\View\Exception\MissingCellTemplateException
set(mixed $name, mixed $value)
Saves a variable or an associative array of variables for use inside a template.
string|array
$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.
$this
setEventManager(\Cake\Event\EventManagerInterface $eventManager)
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.
\Cake\Event\EventManagerInterface
$eventManager the eventManager to set
$this
setModelType(string $modelType)
Set the model type to be used by this class
string
$modelType The model type
$this
setTableLocator(\Cake\ORM\Locator\LocatorInterface $tableLocator)
Sets the table locator.
\Cake\ORM\Locator\LocatorInterface
$tableLocator LocatorInterface instance.
$this
viewBuilder()
Get the view builder being used.
\Cake\View\ViewBuilder
Instance of the View created during rendering. Won't be set until after Cell::__toString()/render() is called.
\Cake\View\View
Caching setup.
array|bool
Default class name for new event objects.
string
Instance of the Cake\Event\EventManager this object is using to dispatch inner events.
\Cake\Event\EventManagerInterface
A list of overridden model factory functions.
(callable|\Cake\Datasource\Locator\LocatorInterface)[]
The model type to use.
string
Table locator instance
\Cake\ORM\Locator\LocatorInterface|null
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.
array
The view builder instance being used.
\Cake\View\ViewBuilder|null
The cell's action to invoke.
string
Arguments to pass to cell's action.
array
This object's primary model class name. Should be a plural form.
CakePHP will not inflect the name.
Example: For an object named 'Comments', the modelClass would be 'Comments'. Plugin classes should use Plugin.Comments
style names to correctly load models from the correct plugin.
Use empty string to not use auto-loading on this object. Null auto-detects based on controller name.
string|null
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.
\Cake\Http\ServerRequest
An instance of a Response object that contains information about the impending response
\Cake\Http\Response
© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/4.1/class-Cake.View.Cell.html