/** * Create an <input type="text" /> field * * @param string $name Field name * @param string $value Field value * @param bool $sticky If set to true, the last posted value will be used */ public function __construct($name, $value = null, $sticky = true) { if ($sticky && isset($_POST[$name])) { $value = $_POST[$name]; } parent::__construct('text', $name, $value); }
public function help() { if ($this->suggestion and !$this->readonly) { $this->help = $this->suggestion(); } return parent::help(); }
public function input() { $input = parent::input(); $input->addClass('icon_text'); $input->data('field', 'iconfield'); return $input; }
/** * Construct a radio button object * @param mixed $value the value of the field * @param array $values the array of values of radio buttons in the set */ function __construct($value, $values) { parent::__construct($value, null); $this->values = $values; $this->ia = new IterableArray($values); if(!$value) { $this->setValue(array_shift($values)); } }
public function input() { $input = parent::input(); $input->attr('step', $this->step); $input->attr('min', $this->min); $input->attr('max', $this->max); return $input; }
protected function getHtmlAttributes($column, $value = null) { $result = parent::getHtmlAttributes($column, $value); if ($length = $column->getLength()) { $result .= "maxlength='{$length}' "; } return $result; }
public function content() { $content = parent::content(); if ($this->buttons) { $content->append($this->buttons()); } return $content; }
public function input() { $input = parent::input(); if (!$this->readonly() && ($this->minLength() || $this->maxLength())) { $input->data('max', $this->maxLength())->data('min', $this->minLength()); } return $input; }
/** * Create an <input type="text" /> field * * @param string $name Field name * @param string $value Field value * @param bool $sticky If set to true, the last posted value will be used */ public function __construct($name, $value = null, $min = 0, $max = 100, $sticky = true) { if ($sticky && isset($_POST[$name])) { $value = $_POST[$name]; } $this->addAttributes(array('min' => $min, 'max' => $max)); parent::__construct('number', $name, $value); }
public function __construct($name, $value = null, $sticky = true) { if ($sticky && isset($_POST[$name]) && isset($_POST[$name][$value]) && $_POST[$name][$value] == 'on') { $this->setChecked(); } $name = $name . '[' . $value . ']'; parent::__construct('checkbox', $name); }
protected function getHtmlAttributes($column, $value = null) { $result = parent::getHtmlAttributes($column, $value); if ($value) { $result .= "checked "; } return $result; }
public function input() { $input = parent::input(); if ($this->autocomplete) { $input->attr('autocomplete', 'off'); $input->data(array('field' => 'autocomplete', 'url' => panel()->urls()->api() . '/autocomplete/emails')); } return $input; }
public function input() { $input = parent::input(); $input->data("field", "pikatime"); if (isset($this->mode)) { $input->data("mode", $this->mode()); } else { $input->data("mode", "24"); } return $input; }
public function input() { $input = parent::input(); $input->removeAttr('name'); $input->data(array('field' => 'date', 'format' => $this->format(), 'i18n' => html(json_encode(array('previousMonth' => '‹', 'nextMonth' => '›', 'months' => l::get('fields.date.months'), 'weekdays' => l::get('fields.date.weekdays'), 'weekdaysShort' => l::get('fields.date.weekdays.short'))), false))); $hidden = new Brick('input', null); $hidden->type = 'hidden'; $hidden->name = $this->name(); $hidden->value = $this->value(); return $input . $hidden; }
public function validate() { if ($this->validate and is_array($this->validate)) { return parent::validate(); } else { if ($this->min and !v::min($this->result(), $this->min)) { return false; } if ($this->max and !v::max($this->result(), $this->max)) { return false; } } return true; }
protected function getHtmlAttributes($column, $value = null) { $result = parent::getHtmlAttributes($column, $value); if ($column->getUnsigned()) { $result .= "min='0' "; } if ($column->getType()->getName() == "float" || $column->getType()->getName() == "decimal") { $zeroDecimal = ""; if ($precision = $column->getScale()) { for ($i = 1; $i < $precision; $i++) { $zeroDecimal .= "0"; } } $result .= "step='0." . $zeroDecimal . "1' "; } return $result; }
public function result() { $result = parent::result(); return v::accepted($result) ? true : false; }
protected function getClass() { return parent::getClass() . ' date-time-field'; }
public function input() { $input = parent::input(); $input->data(array('field' => 'autocomplete', 'url' => url('panel/api/autocomplete/usernames'))); return $input; }
/** * {@inheritDoc} */ public function render(array $attributes = array()) { return parent::render(array_merge(array('type' => 'text', 'maxlength' => $this->getOption('max_length')), $attributes)); }
/** * {@inheritDoc} */ public function __construct($key, array $options = array()) { $options['type'] = 'hidden'; parent::__construct($key, $options); }
/** * Create outer field element. * * @since 1.0.0 * @return \Brick */ public function element() { $element = parent::element(); $element->addClass('field-with-visualmarkdown'); return $element; }
public function input() { $input = parent::input(); $input->data('field', 'urlfield'); return $input; }
/** * Add a field to this form * * @param string $name The name of the field to add * @param InputField $field The input field */ function addField($name, InputField $field) { $field->setForm($this); $this->fields[$name] = $field; }
/** * * @see HTMLElement::getHTML() */ public function getHTML() { // value of password is always cleared before printing $this->clear(); return parent::getHTML(); }
public function result() { // Convert all line-endings to UNIX format return str_replace(array("\r\n", "\r"), "\n", parent::result()); }
public function input() { $input = parent::input(); $input->data(array('field' => 'autocomplete', 'url' => panel()->urls()->api() . '/autocomplete/uris')); return $input; }
/** * Create outer field element. * * @since 1.0.0 * * @return \Brick */ public function element() { $element = parent::element(); $element->addClass('field-with-codeeditor'); return $element; }
/** * {@inheritDoc} */ public function getAttributes() { return array_merge(parent::getAttributes(), array('maxlength' => $this->getOption('max_length'))); }
public function input() { $input = parent::input(); $input->removeClass('input'); return $input; }