#6301: Change default behavior of FormHelper.input to call the type method (if
the
type method exists)
---------------------------+------------------------------------------------
Reporter: captainego | Type: Enhancement
Status: new | Priority: Low
Milestone: 1.3.x.x | Component: Helpers
Version: 1.2 Final | Severity: Minor
Keywords: FormHelper | Php_version: PHP 5
Cake_version: 1.2.1.8004 |
---------------------------+------------------------------------------------
I have been working on some form extensions (making pretty inputs for
social security numbers, phone numbers, zip codes, etc). Currently I have
to reimplement the input function in order to get my pretty inputs to have
the same behaviors as the Form Helper.
[[BR]][[BR]]
If the Form Helper were to call $this->{type} as the default behavior then
classes that extend FormHelper would not have to reimplement inputs.
These classes could just implement the new type function, and pass the
type to the standard input call to generate all of the wrappings. This
change maintains the current default behavior for cases where the type
method does not exist.
[[BR]][[BR]]
The code change would be:
[[BR]]
From FormHelper input (line 797):
{{{
case 'textarea':
$out = $before . $out . $between . $this->textarea($fieldName,
array_merge(
array('cols' => '30', 'rows' => '6'), $options
));
break;
default:
if (method_exists($this, $type)) {
$out = $before . $out . $between .
$this->{$type}($fieldName, $options);
} else {
$out = $before . $out . $between .
$this->textarea($fieldName, array_merge(
array('cols' => '30', 'rows' => '6'), $options
));
}
break;
}}}
--
Ticket URL: <https://trac.cakephp.org/ticket/6301>
CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/>
Cake is a rapid development framework for PHP which uses commonly known design
patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC.
Our primary goal is to provide a structured framework that enables PHP users at
all levels to rapidly develop robust web applications, without any loss to
flexibility.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"tickets cakephp" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/tickets-cakephp?hl=en
-~----------~----~----~----~------~----~------~--~---