Browse Source

feat: allow modifying the Form schema class

Jose Diaz-Gonzalez 8 years ago
parent
commit
7846f7d62a
1 changed files with 7 additions and 1 deletions
  1. 7 1
      src/Form/Form.php

+ 7 - 1
src/Form/Form.php

@@ -35,6 +35,12 @@ use Cake\Validation\Validator;
  */
 class Form
 {
+    /**
+     * Schema class.
+     *
+     * @var string
+     */
+    protected $_schemaClass = '\Cake\Form\Schema';
 
     /**
      * The schema used by this form.
@@ -70,7 +76,7 @@ class Form
     public function schema(Schema $schema = null)
     {
         if ($schema === null && empty($this->_schema)) {
-            $schema = $this->_buildSchema(new Schema());
+            $schema = $this->_buildSchema(new $this->_schemaClass);
         }
         if ($schema) {
             $this->_schema = $schema;