Methods summary
public
MvcCore\Ext\Forms\Field
|
#
SetId( string $id = NULL )
Set form field HTML id attribute, completed from form name and field name.
This value is completed automatically, but you can customize it.
Set form field HTML id attribute, completed from form name and field name.
This value is completed automatically, but you can customize it.
Parameters
Returns
|
public
MvcCore\Ext\Forms\Field
|
#
SetName( string $name = NULL )
Set form field specific name, used to identify submitted value.
This value is required for all form fields.
Set form field specific name, used to identify submitted value.
This value is required for all form fields.
Parameters
Returns
Requires
|
public
MvcCore\Ext\Forms\Field
|
#
SetType( string $type = NULL )
Set form field type, used in <input type="..."> attribute value.
Every typed field has it's own string value, but base field type
\MvcCore\Ext\Forms\Field has NULL .
Set form field type, used in <input type="..."> attribute value.
Every typed field has it's own string value, but base field type
\MvcCore\Ext\Forms\Field has NULL .
Parameters
Returns
|
public
MvcCore\Ext\Forms\Field
|
#
SetValue( string|array|integer|float|null $value )
Set form field value. It could be string or array, in or float, it depends
on field implementation. Default value is NULL .
Set form field value. It could be string or array, in or float, it depends
on field implementation. Default value is NULL .
Parameters
Returns
|
public
MvcCore\Ext\Forms\Field
|
#
SetCssClasses( string|string[] $cssClasses )
Set form field HTML element css classes strings.
All previously defined css classes will be removed.
Default value is an empty array to not render HTML class attribute.
You can define css classes as single string, more classes separated
by space or you can define css classes as array with strings.
Set form field HTML element css classes strings.
All previously defined css classes will be removed.
Default value is an empty array to not render HTML class attribute.
You can define css classes as single string, more classes separated
by space or you can define css classes as array with strings.
Parameters
Returns
|
public
MvcCore\Ext\Forms\Field
|
#
SetTitle( string|null $title, boolean|null $translateTitle = NULL )
Set field title, global HTML attribute, optional.
Set field title, global HTML attribute, optional.
Parameters
Returns
|
public
MvcCore\Ext\Forms\Field
|
#
AddCssClasses( string|string[] $cssClasses )
Add css classes strings for HTML element attribute class .
Given css classes will be added after previously defined css classes.
Default value is an empty array to not render HTML class attribute.
You can define css classes as single string, more classes separated
by space or you can define css classes as array with strings.
Add css classes strings for HTML element attribute class .
Given css classes will be added after previously defined css classes.
Default value is an empty array to not render HTML class attribute.
You can define css classes as single string, more classes separated
by space or you can define css classes as array with strings.
Parameters
Returns
|
public
MvcCore\Ext\Forms\Field
|
#
SetControlAttrs( array $attrs = [] )
Set collection with field HTML element
additional attributes by array keys/values.
Do not use system attributes as: id , name ,
value , readonly , disabled , class ...
Those attributes have it's own configurable properties
by setter methods or by constructor config array.
HTML field elements are meant: <input>,
<button>, <select>, <textarea> ...
Default value is an empty array to not
render any additional attributes.
All previously defined additional field attributes
will be replaced by given array.
Set collection with field HTML element
additional attributes by array keys/values.
Do not use system attributes as: id , name ,
value , readonly , disabled , class ...
Those attributes have it's own configurable properties
by setter methods or by constructor config array.
HTML field elements are meant: <input>,
<button>, <select>, <textarea> ...
Default value is an empty array to not
render any additional attributes.
All previously defined additional field attributes
will be replaced by given array.
Parameters
Returns
|
public
MvcCore\Ext\Forms\Field
|
#
SetControlAttr( string $name, mixed $value )
Set field HTML element additional attribute
by attribute name and value.
Do not use system attributes as: id , name ,
value , readonly , disabled , class ...
Those attributes have it's own configurable properties
by setter methods or by constructor config array.
HTML field elements are meant: <input>,
<button>, <select>, <textarea> ...
Given additional field attribute will be directly
set into additional attributes array and any
previous attribute with the same name will be overwritten.
Set field HTML element additional attribute
by attribute name and value.
Do not use system attributes as: id , name ,
value , readonly , disabled , class ...
Those attributes have it's own configurable properties
by setter methods or by constructor config array.
HTML field elements are meant: <input>,
<button>, <select>, <textarea> ...
Given additional field attribute will be directly
set into additional attributes array and any
previous attribute with the same name will be overwritten.
Parameters
Returns
|
public
MvcCore\Ext\Forms\Field
|
#
AddControlAttrs( array $attrs = [] )
Add (and merge) collection with field HTML element
additional attributes by array keys/values.
Do not use system attributes as: id , name ,
value , readonly , disabled , class ...
Those attributes have it's own configurable properties
by setter methods or by constructor config array.
HTML field elements are meant: <input>,
<button>, <select>, <textarea> ... .
All given additional field attributes
will be merged with previously defined attributes.
Add (and merge) collection with field HTML element
additional attributes by array keys/values.
Do not use system attributes as: id , name ,
value , readonly , disabled , class ...
Those attributes have it's own configurable properties
by setter methods or by constructor config array.
HTML field elements are meant: <input>,
<button>, <select>, <textarea> ... .
All given additional field attributes
will be merged with previously defined attributes.
Parameters
Returns
|
public
MvcCore\Ext\Forms\Field
|
#
SetValidators( array $validatorsNamesOrInstances = [] )
Set list of predefined validator classes ending names or validator instances.
Validator class must exist in any validators namespace(s) configured by default:
- array('\MvcCore\Ext\Forms\Validators\');
Or it could exist in any other validators namespaces, configured by method(s):
- \MvcCore\Ext\Form::AddValidatorsNamespaces(...);
- \MvcCore\Ext\Form::SetValidatorsNamespaces(...);
Every given validator class (ending name) or given validator instance has to
implement interface \MvcCore\Ext\Forms\IValidator or it could be extended
from base abstract validator class: \MvcCore\Ext\Forms\Validator .
Every typed field has it's own predefined validators, but you can define any
validator you want and replace them.
Set list of predefined validator classes ending names or validator instances.
Validator class must exist in any validators namespace(s) configured by default:
- array('\MvcCore\Ext\Forms\Validators\');
Or it could exist in any other validators namespaces, configured by method(s):
- \MvcCore\Ext\Form::AddValidatorsNamespaces(...);
- \MvcCore\Ext\Form::SetValidatorsNamespaces(...);
Every given validator class (ending name) or given validator instance has to
implement interface \MvcCore\Ext\Forms\IValidator or it could be extended
from base abstract validator class: \MvcCore\Ext\Forms\Validator .
Every typed field has it's own predefined validators, but you can define any
validator you want and replace them.
Parameters
- $validatorsNamesOrInstances
Returns
|
public
MvcCore\Ext\Forms\Field
|
#
AddValidators( string[]|MvcCore\Ext\Forms\Validator[] $validatorsNamesOrInstances = [] )
Add list of predefined validator classes ending names or validator instances.
Validator class must exist in any validators namespace(s) configured by default:
- array('\MvcCore\Ext\Forms\Validators\');
Or it could exist in any other validators namespaces, configured by method(s):
- \MvcCore\Ext\Form::AddValidatorsNamespaces(...);
- \MvcCore\Ext\Form::SetValidatorsNamespaces(...);
Every given validator class (ending name) or given validator instance has to
implement interface \MvcCore\Ext\Forms\IValidator or it could be extended
from base abstract validator class: \MvcCore\Ext\Forms\Validator .
Every typed field has it's own predefined validators, but you can define any
validator you want and replace them.
Add list of predefined validator classes ending names or validator instances.
Validator class must exist in any validators namespace(s) configured by default:
- array('\MvcCore\Ext\Forms\Validators\');
Or it could exist in any other validators namespaces, configured by method(s):
- \MvcCore\Ext\Form::AddValidatorsNamespaces(...);
- \MvcCore\Ext\Form::SetValidatorsNamespaces(...);
Every given validator class (ending name) or given validator instance has to
implement interface \MvcCore\Ext\Forms\IValidator or it could be extended
from base abstract validator class: \MvcCore\Ext\Forms\Validator .
Every typed field has it's own predefined validators, but you can define any
validator you want and replace them.
Parameters
- $validatorsNamesOrInstances
Returns
|
public
MvcCore\Ext\Forms\Field
|
#
RemoveValidator( string[]|MvcCore\Ext\Forms\Validator[] $validatorNameOrInstance )
Remove predefined validator by given class ending name or by given validator instance.
Validator class must exist in any validators namespace(s) configured by default:
- array('\MvcCore\Ext\Forms\Validators\');
Or it could exist in any other validators namespaces, configured by method(s):
- \MvcCore\Ext\Form::AddValidatorsNamespaces(...);
- \MvcCore\Ext\Form::SetValidatorsNamespaces(...);
Every given validator class (ending name) or given validator instance has to
implement interface \MvcCore\Ext\Forms\IValidator or it could be extended
from base abstract validator class: \MvcCore\Ext\Forms\Validator .
Every typed field has it's own predefined validators, but you can define any
validator you want and replace them.
Remove predefined validator by given class ending name or by given validator instance.
Validator class must exist in any validators namespace(s) configured by default:
- array('\MvcCore\Ext\Forms\Validators\');
Or it could exist in any other validators namespaces, configured by method(s):
- \MvcCore\Ext\Form::AddValidatorsNamespaces(...);
- \MvcCore\Ext\Form::SetValidatorsNamespaces(...);
Every given validator class (ending name) or given validator instance has to
implement interface \MvcCore\Ext\Forms\IValidator or it could be extended
from base abstract validator class: \MvcCore\Ext\Forms\Validator .
Every typed field has it's own predefined validators, but you can define any
validator you want and replace them.
Parameters
Returns
|
public
MvcCore\Ext\Forms\Field
|
#
SetViewScript( boolean|string|null $boolOrViewScriptPath = NULL )
Set boolean TRUE or string with template relative path
without .phtml or .php extension, if you want to render
field by any custom template.
Set boolean TRUE or string with template relative path
without .phtml or .php extension, if you want to render
field by any custom template.
If TRUE given, path to template
is completed by configured \MvcCore\Ext\Forms\view::SetFieldsDir(...);
value, which is /App/Views/Forms/Fields by default.
If any string with relative path given, path must be relative from configured
\MvcCore\Ext\Forms\view::SetFieldsDir(...); value, which is again
/App/Views/Forms/Fields by default.
To render field naturally, set FALSE , empty string or NULL (NULL is default).
Example:
// To render field template prepared in:
// '/App/Views/Forms/Fields/my-specials/my-field-type.phtml':
\MvcCore\Ext\Forms\View::SetFieldsDir('Forms/Fields'); // by default
$field->SetViewScript('my-specials/my-field-type');
// Or you can do the same by:
\MvcCore\Ext\Forms\View::SetFieldsDir('Forms/Fields/my-specials');
$field->SetType('my-field-type');
Parameters
Returns
|
public
MvcCore\Ext\Forms\Field
|
#
SetJsClassName( string $jsClassName )
Set supporting javascript full javascript class name.
If you want to use any custom supporting javascript prototyped class
for any additional purposes for your custom field, you need to use
$field->SetJsSupportingFile(...) to define path to your javascript file
relatively from configured \MvcCore\Ext\Form::SetJsSupportFilesRootDir(...);
value. Than you have to add supporting javascript file path into field form
in $field->PreDispatch(); method to render those files immediately after form
(once) or by any external custom assets renderer configured by:
$form->SetJsSupportFilesRenderer(...); method.
Or you can add your custom supporting javascript files into response by your
own and also you can run your helper javascripts also by your own. Is up to you.
NULL by default.
Set supporting javascript full javascript class name.
If you want to use any custom supporting javascript prototyped class
for any additional purposes for your custom field, you need to use
$field->SetJsSupportingFile(...) to define path to your javascript file
relatively from configured \MvcCore\Ext\Form::SetJsSupportFilesRootDir(...);
value. Than you have to add supporting javascript file path into field form
in $field->PreDispatch(); method to render those files immediately after form
(once) or by any external custom assets renderer configured by:
$form->SetJsSupportFilesRenderer(...); method.
Or you can add your custom supporting javascript files into response by your
own and also you can run your helper javascripts also by your own. Is up to you.
NULL by default.
Parameters
Returns
|
public
MvcCore\Ext\Forms\Field
|
#
SetJsSupportingFile( string $jsSupportingFilePath )
Set field supporting javascript file relative path.
If you want to use any custom supporting javascript file (with prototyped
class) for any additional purposes for your custom field, you need to
define path to your javascript file relatively from configured
\MvcCore\Ext\Form::SetJsSupportFilesRootDir(...); value.
Than you have to add supporting javascript file path into field form
in $field->PreDispatch(); method to render those files immediately after form
(once) or by any external custom assets renderer configured by:
$form->SetJsSupportFilesRenderer(...); method.
Or you can add your custom supporting javascript files into response by your
own and also you can run your helper javascripts also by your own. Is up to you.
NULL by default.
Set field supporting javascript file relative path.
If you want to use any custom supporting javascript file (with prototyped
class) for any additional purposes for your custom field, you need to
define path to your javascript file relatively from configured
\MvcCore\Ext\Form::SetJsSupportFilesRootDir(...); value.
Than you have to add supporting javascript file path into field form
in $field->PreDispatch(); method to render those files immediately after form
(once) or by any external custom assets renderer configured by:
$form->SetJsSupportFilesRenderer(...); method.
Or you can add your custom supporting javascript files into response by your
own and also you can run your helper javascripts also by your own. Is up to you.
NULL by default.
Parameters
- $jsSupportingFilePath
- $jsFullFile
Returns
|
public
MvcCore\Ext\Forms\Field
|
#
SetCssSupportingFile( string $cssSupportingFilePath )
Set field supporting css file relative path.
If you want to use any custom supporting css file
for any additional purposes for your custom field, you need to
define path to your css file relatively from configured
\MvcCore\Ext\Form::SetCssSupportFilesRootDir(...); value.
Than you have to add supporting css file path into field form
in $field->PreDispatch(); method to render those files immediately after form
(once) or by any external custom assets renderer configured by:
$form->SetCssSupportFilesRenderer(...); method.
Or you can add your custom supporting css files into response by your
own and also you can run your helper css also by your own. Is up to you.
NULL by default.
Set field supporting css file relative path.
If you want to use any custom supporting css file
for any additional purposes for your custom field, you need to
define path to your css file relatively from configured
\MvcCore\Ext\Form::SetCssSupportFilesRootDir(...); value.
Than you have to add supporting css file path into field form
in $field->PreDispatch(); method to render those files immediately after form
(once) or by any external custom assets renderer configured by:
$form->SetCssSupportFilesRenderer(...); method.
Or you can add your custom supporting css files into response by your
own and also you can run your helper css also by your own. Is up to you.
NULL by default.
Parameters
- $cssSupportingFilePath
- $cssFullFile
Returns
|
public
MvcCore\Ext\Forms\Field
|
#
SetTranslate( boolean $translate )
Set boolean flag about field visible texts and error messages translation.
This flag is automatically assigned from $field->form->GetTranslate();
flag in $field->Init(); method.
Set boolean flag about field visible texts and error messages translation.
This flag is automatically assigned from $field->form->GetTranslate();
flag in $field->Init(); method.
Parameters
Returns
|
public
MvcCore\Ext\Forms\Field
|
#
AddError( string $errorMsg )
Add field error message text to render it in rendering process.
This method is only for rendering purposes, not to add errors
into session. It's always called internally from \MvcCore\Ext\Form
in render preparing process. To add form error properly,
use $field->form->AddError($errorMsg, $fieldNames); method instead.
Add field error message text to render it in rendering process.
This method is only for rendering purposes, not to add errors
into session. It's always called internally from \MvcCore\Ext\Form
in render preparing process. To add form error properly,
use $field->form->AddError($errorMsg, $fieldNames); method instead.
Parameters
Returns
|
public static
string
|
#
SetTemplate( string $templateName = 'control', string $templateCode = '' )
Set field (or label) default template for natural
(not customized with *.phtml view) field rendering.
Set field (or label) default template for natural
(not customized with *.phtml view) field rendering.
Parameters
- $templateName
- Template name in array
static::$templates .
- $templateCode
- Template HTML code with prepared replacements.
Returns
string Newly configured template value.
|
public static
array
|
#
SetTemplates( array|stdClass $templates = [] )
Set fields (and labels) default templates for natural
(not customized with *.phtml view) field rendering.
Set fields (and labels) default templates for natural
(not customized with *.phtml view) field rendering.
Parameters
Returns
array
|