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

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

  • 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
      • Fixture
      • Stub
    • Utility
      • Exception
    • Validation
    • View
      • Exception
      • Form
      • Helper
      • Widget
  • None

Classes

  • ArrayContext
  • ContextFactory
  • EntityContext
  • FormContext
  • NullContext

Interfaces

  • ContextInterface
  1: <?php
  2: /**
  3:  * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
  4:  * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  5:  *
  6:  * Licensed under The MIT License
  7:  * For full copyright and license information, please see the LICENSE.txt
  8:  * Redistributions of files must retain the above copyright notice.
  9:  *
 10:  * @copyright     Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
 11:  * @link          https://cakephp.org CakePHP(tm) Project
 12:  * @since         3.0.0
 13:  * @license       https://opensource.org/licenses/mit-license.php MIT License
 14:  */
 15: namespace Cake\View\Form;
 16: 
 17: /**
 18:  * Interface for FormHelper context implementations.
 19:  *
 20:  * @method string|null getRequiredMessage($field) Gets the default "required" error message for a field
 21:  * @method int|null getMaxLength($field) Get maximum length of a field from model validation
 22:  */
 23: interface ContextInterface
 24: {
 25:     /**
 26:      * Get the fields used in the context as a primary key.
 27:      *
 28:      * @return array
 29:      */
 30:     public function primaryKey();
 31: 
 32:     /**
 33:      * Returns true if the passed field name is part of the primary key for this context
 34:      *
 35:      * @param string $field A dot separated path to the field a value
 36:      *   is needed for.
 37:      * @return bool
 38:      */
 39:     public function isPrimaryKey($field);
 40: 
 41:     /**
 42:      * Returns whether or not this form is for a create operation.
 43:      *
 44:      * @return bool
 45:      */
 46:     public function isCreate();
 47: 
 48:     /**
 49:      * Get the current value for a given field.
 50:      *
 51:      * Classes implementing this method can optionally have a second argument
 52:      * `$options`. Valid key for `$options` array are:
 53:      *
 54:      *   - `default`: Default value to return if no value found in request
 55:      *     data or context record.
 56:      *   - `schemaDefault`: Boolean indicating whether default value from
 57:      *      context's schema should be used if it's not explicitly provided.
 58:      *
 59:      * @param string $field A dot separated path to the field a value
 60:      *   is needed for.
 61:      * @return mixed
 62:      */
 63:     public function val($field);
 64: 
 65:     /**
 66:      * Check if a given field is 'required'.
 67:      *
 68:      * In this context class, this is simply defined by the 'required' array.
 69:      *
 70:      * @param string $field A dot separated path to check required-ness for.
 71:      * @return bool
 72:      */
 73:     public function isRequired($field);
 74: 
 75:     /**
 76:      * Get the fieldnames of the top level object in this context.
 77:      *
 78:      * @return string[] A list of the field names in the context.
 79:      */
 80:     public function fieldNames();
 81: 
 82:     /**
 83:      * Get the abstract field type for a given field name.
 84:      *
 85:      * @param string $field A dot separated path to get a schema type for.
 86:      * @return string|null An abstract data type or null.
 87:      * @see \Cake\Database\Type
 88:      */
 89:     public function type($field);
 90: 
 91:     /**
 92:      * Get an associative array of other attributes for a field name.
 93:      *
 94:      * @param string $field A dot separated path to get additional data on.
 95:      * @return array An array of data describing the additional attributes on a field.
 96:      */
 97:     public function attributes($field);
 98: 
 99:     /**
100:      * Check whether or not a field has an error attached to it
101:      *
102:      * @param string $field A dot separated path to check errors on.
103:      * @return bool Returns true if the errors for the field are not empty.
104:      */
105:     public function hasError($field);
106: 
107:     /**
108:      * Get the errors for a given field
109:      *
110:      * @param string $field A dot separated path to check errors on.
111:      * @return array An array of errors, an empty array will be returned when the
112:      *    context has no errors.
113:      */
114:     public function error($field);
115: }
116: 
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