public function testText() { //test where valueOrArray is array $html = $this->object->text('element', array('arbitrary' => 'arbitrary', 'class' => 'test-class')); $this->assertAttributes($html, array('class' => array('test-class', 'ccm-input-text'), 'arbitrary' => 'arbitrary', 'type' => 'text')); //test where valueOrArray is value $html = $this->object->text('element', 'value', array('arbitrary' => 'arbitrary', 'class' => 'test-class')); $this->assertAttributes($html, array('class' => array('test-class', 'ccm-input-text'), 'value' => 'value', 'arbitrary' => 'arbitrary', 'type' => 'text')); }
<?php $classRequired = $divClassOverride ? $divClassOverride : 'user-or-hash-wrapper'; $form = new FormHelper(); ?> <div class="<?php echo $classRequired; ?> "> <?php echo $form->select('userOrHash[]', $userTimelineOrHashSelectArray, $type); ?> <?php echo $form->text('userOrHashValue[]', $value, array('style' => 'size:40;')); ?> <a class="setting-remove"><img src="<?php echo $this->getBlockUrl(); ?> /images/delete.png" alt='<?php echo t("delete"); ?> ' title='<?php echo t("delete"); ?> ' width='16' height='16' style='vertical-align: middle;' /></a> <?php if (false && $lastSetting) { ?> <a href="#" class="add-timeline-component" id="add-timeline-component-button"><img src="<?php echo $this->getBlockUrl(); ?>
?> "> <label for="alignment">Alignement</label> <?php echo FormHelper::radios('alignment', array('' => 'Aucun', 'right' => 'Droite', 'center' => 'Centrer', 'left' => 'Gauche'), ''); ?> </div> <div class="<?php echo ++$i % 2 ? 'odd' : 'even'; ?> "> <label for="link">Lien</label> <?php echo FormHelper::text('href', '', array('size' => '100')); ?> <br /> <?php echo FormHelper::checkbox('target', '_blank', '_blank'); ?> Ouvrir dans une nouvelle fenêtre </div> </fieldset> <div> <input class="button" type="submit" value="Insérer dans l'éditeur"> ou <a class="cancel" href="<?php echo UrlComponent::path(array('action' => 'insertionIndex')); ?>
public function testInputText() { $this->assertEqual(FormHelper::text('name', 'value', array('class' => 'myClass')), '<input type="text" name="name" class="myClass" value="value" id="name">'); $this->assertEqual(FormHelper::text('name', $this->Model, array('class' => 'myClass')), '<input type="text" name="name" class="myClass" value="obj" id="name">'); }
static function datetime($name, $value = '', $years = array(), $attributes = array()) { $prefix = '_' . $name . '_'; $value = is_object($value) ? $value[$name] : $value; $date = $time = null; $year = $month = $day = null; $hour = $minutes = $seconds = null; $with_seconds = null; if (!$value || $value == 'NOW()' || $value == 'TODAY()') { $value = date('Y-m-d H:i:s'); } if (isset($attributes['seconds']) && $attributes['seconds'] == true) { $with_seconds = true; unset($attributes['seconds']); } if (@(list($date, $time) = explode(' ', $value))) { @(list($year, $month, $day) = explode('-', $date)); @(list($hour, $minutes, $seconds) = explode(':', $time)); } $html = self::date($name, $value, (array) $years, (array) $attributes); $html .= ' ' . __('à') . ' '; $html .= FormHelper::text($prefix . 'hour', $hour, array('size' => 2, 'maxlength' => 2)); $html .= ' : '; $html .= FormHelper::text($prefix . 'minutes', $minutes, array('size' => 2, 'maxlength' => 2)); if ($with_seconds) { $html .= ' : '; $html .= FormHelper::text($prefix . 'seconds', $seconds, array('size' => 2, 'maxlength' => 2)); } else { $html .= FormHelper::hidden($prefix . 'seconds', $seconds); } return $html; }
function text($field, $options = array()) { return parent::text($field, $options); }
/** * Creates a text input widget. * * @param string $fieldName Name of a field, in the form "Modelname.fieldname" * @param array $options Array of HTML attributes. * @return string A generated HTML text input element * @access public * @link http://book.cakephp.org/view/1432/text */ public function text($fieldName, $options = array()) { $options = $this->_addPlaceholder($fieldName, $options); return parent::text($fieldName, $options); }