Factory for getting form context instance based on provided data.
$providers
protected array
__construct( array $providers [] )
Constructor.
$providers
optional [] Array of provider callables. Each element should be of form ['type' => 'a-string', 'callable' => ..]
addProvider( string $type , callable $check )
Add a new context type.
Form context types allow FormHelper to interact with data providers that come from outside CakePHP. For example if you wanted to use an alternative ORM like Doctrine you could create and connect a new context class to allow FormHelper to read metadata from doctrine.
$type
The type of context. This key can be used to overwrite existing providers.
$check
A callable that returns an object when the form context is the correct type.
createWithDefaults( array $providers [] )
Create factory instance with providers "array", "form" and "orm".
$providers
optional [] Array of provider callables. Each element should be of form ['type' => 'a-string', 'callable' => ..]
Cake\View\Form\ContextFactory
get( Cake\Http\ServerRequest $request , array $data [] )
Find the matching context for the data.
If no type can be matched a NullContext will be returned.
Cake\Http\ServerRequest
$request
$data
optional [] Cake\View\Form\ContextInterface
when the context class does not implement the ContextInterface.
© 2005–2017 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/3.5/class-Cake.View.Form.ContextFactory.html