本文整理汇总了PHP中opToolkit::appendMobileInputModeAttributesForFormWidget方法的典型用法代码示例。如果您正苦于以下问题:PHP opToolkit::appendMobileInputModeAttributesForFormWidget方法的具体用法?PHP opToolkit::appendMobileInputModeAttributesForFormWidget怎么用?PHP opToolkit::appendMobileInputModeAttributesForFormWidget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类opToolkit
的用法示例。
在下文中一共展示了opToolkit::appendMobileInputModeAttributesForFormWidget方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: appendMobileInputMode
protected function appendMobileInputMode()
{
parent::appendMobileInputMode();
foreach ($this as $k => $v) {
$widget = $this->widgetSchema[$k];
$validator = $this->validatorSchema[$k];
if ($widget instanceof opWidgetFormInputIncreased) {
opToolkit::appendMobileInputModeAttributesForFormWidget($widget, 'numeric');
}
}
}
示例2: appendMobileInputMode
protected function appendMobileInputMode()
{
foreach ($this as $k => $v) {
$widget = $this->widgetSchema[$k];
$validator = $this->validatorSchema[$k];
if (!$widget instanceof sfWidgetFormInput) {
continue;
}
if ($widget instanceof sfWidgetFormInputPassword) {
opToolkit::appendMobileInputModeAttributesForFormWidget($widget, 'alphabet');
} elseif ($validator instanceof sfValidatorEmail) {
opToolkit::appendMobileInputModeAttributesForFormWidget($widget, 'alphabet');
} elseif ($validator instanceof sfValidatorNumber) {
opToolkit::appendMobileInputModeAttributesForFormWidget($widget, 'numeric');
}
}
}
示例3: render
/**
* @see sfWidgetFormDate
*/
public function render($name, $value = null, $attributes = array(), $errors = array())
{
$dateTimeValue = is_array($value) ? sprintf('%04d-%02d-%02d', $value['year'], $value['month'], $value['day']) : $value;
try {
$dateTime = new DateTime($dateTimeValue);
} catch (Exception $e) {
$dateTime = new DateTime();
$dateTimeValue = null;
}
$dayDefault = $dateTime->format('j');
$monthDefault = $dateTime->format('n');
$year = $dateTime->format('Y');
$days = $this->getOption('days');
$months = $this->getOption('months');
if ($this->getOption('can_be_empty')) {
$emptyValues = $this->getOption('empty_values');
$days = array('' => $emptyValues['day']) + $days;
$months = array('' => $emptyValues['month']) + $months;
if (!$dateTimeValue) {
$dayDefault = $emptyValues['day'];
$monthDefault = $emptyValues['month'];
$year = $emptyValues['year'];
}
}
if (is_array($value) && !checkdate((int) $value['month'], (int) $value['day'], (int) $value['year'])) {
$dayDefault = $value['day'];
$monthDefault = $value['month'];
$year = $value['year'];
}
// days
$widget = new sfWidgetFormSelect(array('choices' => $days), array_merge($this->attributes, $attributes));
$date['%day%'] = $widget->render($name . '[day]', $dayDefault);
// months
$widget = new sfWidgetFormSelect(array('choices' => $months), array_merge($this->attributes, $attributes));
$date['%month%'] = $widget->render($name . '[month]', $monthDefault);
// years
$attributes['size'] = '5';
$widget = new sfWidgetFormInput(array(), array_merge(array('class' => 'input_text'), $this->attributes, $attributes));
if ('mobile_frontend' === sfConfig::get('sf_app')) {
opToolkit::appendMobileInputModeAttributesForFormWidget($widget, 'numeric');
}
$date['%input_year%'] = $widget->render($name . '[year]', $year);
return strtr($this->getOption('format'), $date);
}
示例4: configure
public function configure()
{
$this->setWidget('mail_address', new sfWidgetFormInputText());
$this->setValidator('mail_address', new sfValidatorPass());
if ($this->getOption('invited')) {
$this->setWidget('message', new sfWidgetFormTextarea());
$this->setValidator('message', new sfValidatorPass());
$this->widgetSchema->setLabel('message', 'Message(Arbitrary)');
}
$callback = new sfValidatorCallback(array('callback' => array($this, 'validate')));
$callback->setMessage('invalid', 'invalid e-mail address');
$this->validatorSchema->setPostValidator($callback);
if (sfConfig::get('op_is_use_captcha', false)) {
$this->embedForm('captcha', new opCaptchaForm());
}
if ('mobile_frontend' === sfConfig::get('sf_app')) {
opToolkit::appendMobileInputModeAttributesForFormWidget($this->getWidget('mail_address'), 'alphabet');
}
}
示例5: slot
$hasRequiredField = false;
?>
<?php
slot('form');
foreach ($forms as $form) {
echo $form->renderHiddenFields();
foreach ($form as $name => $field) {
if ($field->isHidden()) {
continue;
}
$attributes = array();
$widget = $field->getWidget();
$validator = $form->getValidator($name);
if ($widget instanceof sfWidgetFormInputPassword) {
$widget = opToolkit::appendMobileInputModeAttributesForFormWidget($widget, 'alphabet');
}
if ($widget instanceof opWidgetFormProfile) {
$widget = $widget->getOption('widget');
$validator = $validator->getOption('validator');
}
if ($widget instanceof sfWidgetFormChoice) {
if ($widget->getRenderer() instanceof sfWidgetFormSelectRadio || $widget->getRenderer() instanceof sfWidgetFormSelectCheckbox) {
$widget->setOption('renderer_options', array_merge(array('formatter' => array('opWidgetFormSelectFormatterMobile', 'formatter'), 'separator' => "<br>\n"), $widget->getOption('renderer_options')));
}
} elseif ($widget instanceof sfWidgetFormSelectRadio || $widget instanceof sfWidgetFormSelectCheckbox) {
$widget->setOption('formatter', array('opWidgetFormSelectFormatterMobile', 'formatter'));
$widget->setOption('separator', "<br>\n");
}
if ($options['mark_required_field'] && !$validator instanceof sfValidatorPass && !$validator instanceof sfValidatorSchema && $validator->getOption('required')) {
echo sprintf('<font color="%s">*</font>', opColorConfig::get('core_color_22'));