本文整理汇总了PHP中FormHelper::to_input_field_tag方法的典型用法代码示例。如果您正苦于以下问题:PHP FormHelper::to_input_field_tag方法的具体用法?PHP FormHelper::to_input_field_tag怎么用?PHP FormHelper::to_input_field_tag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormHelper
的用法示例。
在下文中一共展示了FormHelper::to_input_field_tag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: file_field
/**
* Works just like text_field, but returns a input tag of the "file" type instead, which won't have any default value.
* @uses FormHelper::to_input_field_tag()
*/
function file_field($object, $field, $options = array())
{
$form = new FormHelper($object, $field);
return $form->to_input_field_tag("file", $options);
}
示例2: array
/**
* @todo Document this method
*
* @param string object_name Name of an ActiveRecord subclass
* @param string attribute_name Name of an attribute of $object_name
* @param string[] options
* @uses attribute_name
* @uses column_type()
* @uses error_wrapping()
* @uses object_name
* @uses DateHelper::to_date_select_tag()
* @uses FormHelper::to_boolean_select_tag()
* @uses FormHelper::to_input_field_tag()
* @uses FormHelper::to_text_area_tag()
* @uses to_datetime_select_tag()
* @uses object()
*/
function to_tag($object_name, $attribute_name, $options = array())
{
$this->object_name = $object_name;
$this->attribute_name = $attribute_name;
$form = new FormHelper($object_name, $attribute_name);
switch ($this->column_type()) {
case 'string':
case 'varchar':
case 'varchar2':
$field_type = preg_match("/password/i", $this->attribute_name) ? "password" : "text";
$results = $form->to_input_field_tag($field_type, $options);
break;
case 'text':
case 'blob':
$results = $form->to_text_area_tag($options);
break;
case 'integer':
case 'int':
case 'number':
case 'float':
case 'real':
$results = $form->to_input_field_tag("text", $options);
break;
case 'date':
$form = new DateHelper($object_name, $attribute_name);
$results = $form->to_date_select_tag($options);
break;
case 'datetime':
case 'timestamp':
$results = $this->to_datetime_select_tag($options);
break;
case 'boolean':
case 'bool':
$results = $form->to_boolean_select_tag($options);
break;
}
if (count($this->object()->errors)) {
$results = $this->error_wrapping($results, $this->object()->errors[$this->attribute_name]);
}
return $results;
}