1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150:
<?php
/**
* MvcCore
*
* This source file is subject to the BSD 3 License
* For the full copyright and license information, please view
* the LICENSE.md file that are distributed with this source code.
*
* @copyright Copyright (c) 2016 Tom Flidr (https://github.com/mvccore)
* @license https://mvccore.github.io/docs/mvccore/5.0.0/LICENCE.md
*/
namespace MvcCore\Ext\Form;
interface IConstants {
/**
* Form http submitting method (`GET`).
*/
const METHOD_GET = 'GET';
/**
* Form http submitting method (`POST`).
*/
const METHOD_POST = 'POST';
/**
* Form `enctype` attribute value `application/x-www-form-urlencoded`,
* By submitting - all form values will be encoded
* to `key1=value1&key2=value2&...` string.
* This `enctype` type is used for all `\MvcCore\Ext\Form` instances by default.
*/
const ENCTYPE_URLENCODED = 'application/x-www-form-urlencoded';
/**
* Form enctype attribute value `multipart/form-data`,
* By submitting - data will not be encoded to URL string form.
* This value is required when you are using forms that have a file upload control.
*/
const ENCTYPE_MULTIPART = 'multipart/form-data';
/**
* Form `enctype` attribute value `application/x-www-form-urlencoded`,
* By submitting - spaces will be converted to `+` symbols,
* but no other special characters will be encoded.
*/
const ENCTYPE_PLAINTEXT = 'text/plain';
/**
* Html id attributes delimiter,
* used for form controls to complete
* it's ids as `<form-id>_<control-name>`.
*/
const HTML_IDS_DELIMITER = '_';
/**
* Form submit result state (`0` - error happened).
* Submit was not successful, there was an error or errors.
*/
const RESULT_ERRORS = 0;
/**
* Form submit result state (`1` - everything OK).
* Submit was successful, no error happened.
* User could be redirected to success url.
*/
const RESULT_SUCCESS = 1;
/**
* Form submit result state (`2` - everything OK, redirect user to previous step url).
* Submit was successful, no error happened and one of submitting
* button is control to indicate that user could be redirected
* to previous step URL in multiple forms wizard (typically e-shop ordering).
*/
const RESULT_PREV_PAGE = 2;
/**
* Form submit result state (`3` - everything OK, redirect user to next step url).
* Submit was successful, no error happened and one of submitting
* button is control to indicate that user could be redirected
* to next step URL in multiple forms wizard (typically e-shop ordering).
*/
const RESULT_NEXT_PAGE = 3;
/**
* Control/labels rendering mode (`normal`).
* Label will be rendered before control,
* only checkbox and radio button label
* will be rendered after control.
*/
const FIELD_RENDER_MODE_NORMAL = 'normal';
/**
* Control/labels rendering mode (`no-label`).
* No label will be rendered with control.
*/
const FIELD_RENDER_MODE_NO_LABEL = 'no-label';
/**
* Control/labels rendering mode (`label-around`).
* Label will be rendered around control.
*/
const FIELD_RENDER_MODE_LABEL_AROUND = 'label-around';
/**
* Control errors rendering mode (`all-together`).
* All errors are rendered naturally at form begin together in one HTML `<div>` element.
* If you are using custom template for form - you have to call after form beginning
* `$form->RenderErrors();` to get all errors into template. This value is used as
* default for all `\MvcCore\Ext\Form` instances.
*/
const ERROR_RENDER_MODE_ALL_TOGETHER = 'all-together';
/**
* Control errors rendering mode (`before-each-control`).
* If there will be any error, it will be rendered as single span.errors
* before current form control with single or multiple span.error elements
* inside, by errors count for current form control. It will be rendered in
* natural form rendering mode without template but also in custom form rendering mode
* with template if you call anytime in template `$field->RenderLabelAndControl();`
* If you will use in custom form rendering mod with template method `$field->RenderControl();`,
* there will be not rendered any error spans before control, you have to use `$field->RenderErrors();`
* to get errors for each control.
*/
const ERROR_RENDER_MODE_BEFORE_EACH_CONTROL = 'before-each-control';
/**
* Control errors rendering mode (`after-each-control`).
* If there will be any error, it will be rendered as single span.errors
* after current form control with single or multiple span.error elements
* inside, by errors count for current form control. It will be rendered in
* natural form rendering mode without template but also in custom form rendering mode
* with template if you call anytime in template `$field->RenderLabelAndControl();`
* If you will use in custom form rendering mode with template method `$field->RenderControl();`,
* there will be rendered no error spans before control, you have to use `$field->RenderErrors();`
* to get errors for each control.
*/
const ERROR_RENDER_MODE_AFTER_EACH_CONTROL = 'after-each-control';
/**
* MvcCore Form extension library directory replacement string.
*/
const FORM_ASSETS_DIR_REPLACEMENT = '__MVCCORE_FORM_ASSETS_DIR__';
}