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 6.0 API

  • Project:
    • CakePHP
      • CakePHP
      • Authentication
      • Authorization
      • Chronos
      • Elastic Search
      • Queue
  • Version:
    • 6.0
      • 6.0
      • 5.4
      • 5.3
      • 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
    • AttributeResolver
    • Cache
    • Collection
    • Command
    • Console
    • Container
    • Controller
    • Core
    • Database
    • Datasource
    • Error
    • Event
    • Form
    • Http
    • I18n
    • Lock
    • Log
    • Mailer
    • Network
    • ORM
    • Routing
    • TestSuite
    • Utility
    • Validation
    • View

Namespace Form

Interfaces

  • ContextInterface

    Interface for FormHelper context implementations.

Classes

  • ArrayContext

    Provides a basic array based context provider for FormHelper.

    This adapter is useful in testing or when you have forms backed by simple array data structures.

    Important keys:

    • data Holds the current values supplied for the fields.
    • defaults The default values for fields. These values will be used when there is no data set. Data should be nested following the dot separated paths you access your fields with.
    • required A nested array of fields, relationships and boolean flags to indicate a field is required. The value can also be a string to be used as the required error message
    • schema An array of data that emulate the column structures that {@link \Cake\Database\Schema\TableSchema} uses. This array allows you to control the inferred type for fields and allows auto generation of attributes like maxlength, step and other HTML attributes. If you want primary key/id detection to work. Make sure you have provided a _constraints array that contains primary. See below for an example.
    • errors An array of validation errors. Errors should be nested following the dot separated paths you access your fields with.

    Example

     $article = [
       'data' => [
         'id' => '1',
         'title' => 'First post!',
       ],
       'schema' => [
         'id' => ['type' => 'integer'],
         'title' => ['type' => 'string', 'length' => 255],
         '_constraints' => [
           'primary' => ['type' => 'primary', 'columns' => ['id']]
         ]
       ],
       'defaults' => [
         'title' => 'Default title',
       ],
       'required' => [
         'id' => true, // will use default required message
         'title' => 'Please enter a title',
         'body' => false,
       ],
     ];
  • ContextFactory

    Factory for getting form context instance based on provided data.

  • EntityContext

    Provides a form context around a single entity and its relations. It also can be used as context around an array or iterator of entities.

    This class lets FormHelper interface with entities or collections of entities.

    Important Keys:

    • entity The entity this context is operating on.
    • table Either the ORM\Table instance to fetch schema/validators from, an array of table instances in the case of a form spanning multiple entities, or the name(s) of the table. If this is null the table name(s) will be determined using naming conventions.
    • validator Either the Validation\Validator to use, or the name of the validation method to call on the table object. For example 'default'. Defaults to 'default'. Can be an array of table alias=>validators when dealing with associated forms.
  • FormContext

    Provides a context provider for {@link \Cake\Form\Form} instances.

    This context provider simply fulfils the interface requirements that FormHelper has and allows access to the form data.

  • NullContext

    Provides a context provider that does nothing.

    This context provider simply fulfils the interface requirements that FormHelper has.

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