Commit c2503598 by Crisu83

added support for inputs with both prepend and append (fixes #41)

parent c6bc778d
...@@ -152,6 +152,11 @@ abstract class BootInput extends CInputWidget ...@@ -152,6 +152,11 @@ abstract class BootInput extends CInputWidget
return ''; return '';
} }
/**
* Returns the prepend element for the input.
* @param array $htmlOptions additional HTML attributes
* @return string the element
*/
protected function getPrepend($htmlOptions = array()) protected function getPrepend($htmlOptions = array())
{ {
if ($this->hasAddOn()) if ($this->hasAddOn())
...@@ -173,6 +178,11 @@ abstract class BootInput extends CInputWidget ...@@ -173,6 +178,11 @@ abstract class BootInput extends CInputWidget
return ''; return '';
} }
/**
* Returns the append element for the input.
* @param array $htmlOptions additional HTML attributes
* @return string the element
*/
protected function getAppend($htmlOptions = array()) protected function getAppend($htmlOptions = array())
{ {
if ($this->hasAddOn()) if ($this->hasAddOn())
...@@ -193,16 +203,25 @@ abstract class BootInput extends CInputWidget ...@@ -193,16 +203,25 @@ abstract class BootInput extends CInputWidget
return ''; return '';
} }
/**
* Returns the input container CSS classes.
* @return string the classes
*/
protected function getInputContainerCssClass() protected function getInputContainerCssClass()
{ {
$class = array();
if (isset($this->htmlOptions['prepend'])) if (isset($this->htmlOptions['prepend']))
return 'input-prepend'; $class[] = 'input-prepend';
else if (isset($this->htmlOptions['append'])) if (isset($this->htmlOptions['append']))
return 'input-append'; $class[] = 'input-append';
else
return ''; return implode(' ', $class);
} }
/**
* Returns whether the input has an add-on (prepend and/or append).
* @return boolean the result
*/
protected function hasAddOn() protected function hasAddOn()
{ {
return isset($this->htmlOptions['prepend']) || isset($this->htmlOptions['append']); return isset($this->htmlOptions['prepend']) || isset($this->htmlOptions['append']);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment