1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-25 05:58:21 +01:00
phorge-phorge/src/view/form/control/AphrontFormTextControl.php
Tal Shiri 2133e61048 Added placeholder support to custom text fields
Summary: placeholder text is pretty useful.

Test Plan: placeholder text is pretty useful. also fully supports not breaking everything.

Reviewers: chad, #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9223
2014-05-22 09:12:55 -07:00

55 lines
1.3 KiB
PHP

<?php
final class AphrontFormTextControl extends AphrontFormControl {
private $disableAutocomplete;
private $sigil;
private $placeholder;
public function setDisableAutocomplete($disable) {
$this->disableAutocomplete = $disable;
return $this;
}
private function getDisableAutocomplete() {
return $this->disableAutocomplete;
}
public function getPlaceholder() {
return $this->placeholder;
}
public function setPlaceholder($placeholder) {
$this->placeholder = $placeholder;
return $this;
}
public function getSigil() {
return $this->sigil;
}
public function setSigil($sigil) {
$this->sigil = $sigil;
return $this;
}
protected function getCustomControlClass() {
return 'aphront-form-control-text';
}
protected function renderInput() {
return javelin_tag(
'input',
array(
'type' => 'text',
'name' => $this->getName(),
'value' => $this->getValue(),
'disabled' => $this->getDisabled() ? 'disabled' : null,
'autocomplete' => $this->getDisableAutocomplete() ? 'off' : null,
'id' => $this->getID(),
'sigil' => $this->getSigil(),
'placeholder' => $this->getPlaceholder()
));
}
}