Skip to content

Commit

Permalink
Update methods to use toHtmlString() (#11)
Browse files Browse the repository at this point in the history
* Update methods to use toHtmlString()
  • Loading branch information
Archez authored and Martin Hrášek committed Dec 12, 2017
1 parent 74ead1f commit 6423c68
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions src/BootstrapFormBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class BootstrapFormBuilder extends CollectiveFormBuilder
* @param string $name
* @param mixed $label
* @param array $options
* @return string
* @return \Illuminate\Support\HtmlString
*/
public function openGroup($name, $label = null, $options = array())
{
Expand All @@ -32,21 +32,21 @@ public function openGroup($name, $label = null, $options = array())

$label = $label ? $this->label($name, $label) : '';

return '<div'.$this->html->attributes($options).'>'.$label;
return $this->toHtmlString('<div'.$this->html->attributes($options).'>'.$label);
}

/**
* Close out the opened form group
*
* @return string
* @return \Illuminate\Support\HtmlString
*/
public function closeGroup()
{
$name = array_pop($this->groupStack);

$errors = $this->getFormattedErrors($name);

return $errors.'</div>';
return $this->toHtmlString($errors.'</div>');
}

/**
Expand All @@ -56,7 +56,7 @@ public function closeGroup()
* @param string $name
* @param string $value
* @param array $options
* @return string
* @return \Illuminate\Support\HtmlString
*/
public function input($type, $name, $value = null, $options = array())
{
Expand All @@ -73,7 +73,7 @@ public function input($type, $name, $value = null, $options = array())
* @param string $selected
* @param array $selectAttributes
* @param array $optionsAttributes
* @return string
* @return \Illuminate\Support\HtmlString
*/
public function select(
$name,
Expand All @@ -94,7 +94,7 @@ public function select(
* @param string $name
* @param string $value
* @param array $options
* @return string
* @return \Illuminate\Support\HtmlString
*/
public function plainInput($type, $name, $value = null, $options = array())
{
Expand All @@ -109,7 +109,7 @@ public function plainInput($type, $name, $value = null, $options = array())
* @param string $selected
* @param array $selectAttributes
* @param array $optionsAttributes
* @return string
* @return \Illuminate\Support\HtmlString
*/
public function plainSelect($name, $list = array(), $selected = null, array $selectAttributes = [], array $optionsAttributes = [])
{
Expand All @@ -124,7 +124,7 @@ public function plainSelect($name, $list = array(), $selected = null, array $sel
* @param mixed $value
* @param bool $checked
* @param array $options
* @return string
* @return \Illuminate\Support\HtmlString
*/
protected function checkable($type, $name, $value, $checked, $options)
{
Expand All @@ -141,7 +141,7 @@ protected function checkable($type, $name, $value, $checked, $options)
* @param mixed $label
* @param bool $checked
* @param array $options
* @return string
* @return \Illuminate\Support\HtmlString
*/
public function checkbox($name, $value = 1, $label = null, $checked = null, $options = array())
{
Expand All @@ -160,7 +160,7 @@ public function checkbox($name, $value = 1, $label = null, $checked = null, $opt
* @param mixed $label
* @param bool $checked
* @param array $options
* @return string
* @return \Illuminate\Support\HtmlString
*/
public function radio($name, $value = null, $label = null, $checked = null, $options = array())
{
Expand All @@ -179,7 +179,7 @@ public function radio($name, $value = null, $label = null, $checked = null, $opt
* @param mixed $label
* @param bool $checked
* @param array $options
* @return string
* @return \Illuminate\Support\HtmlString
*/
public function inlineCheckbox($name, $value = 1, $label = null, $checked = null, $options = array())
{
Expand All @@ -198,7 +198,7 @@ public function inlineCheckbox($name, $value = 1, $label = null, $checked = null
* @param mixed $label
* @param bool $checked
* @param array $options
* @return string
* @return \Illuminate\Support\HtmlString
*/
public function inlineRadio($name, $value = null, $label = null, $checked = null, $options = array())
{
Expand All @@ -215,7 +215,7 @@ public function inlineRadio($name, $value = null, $label = null, $checked = null
* @param string $name
* @param string $value
* @param array $options
* @return string
* @return \Illuminate\Support\HtmlString
*/
public function textarea($name, $value = null, $options = array())
{
Expand All @@ -232,7 +232,7 @@ public function textarea($name, $value = null, $options = array())
* @param string $name
* @param string $value
* @param array $options
* @return string
* @return \Illuminate\Support\HtmlString
*/
public function plainTextarea($name, $value = null, $options = array())
{
Expand Down Expand Up @@ -321,11 +321,11 @@ private function getFormattedErrors($name)
* @param mixed $label
* @param string $type
* @param string $checkAble
* @return string
* @return \Illuminate\Support\HtmlString
*/
private function wrapCheckable($label, $type, $checkAble)
{
return '<div class="'.$type.'"><label>'.$checkAble.' '.$label.'</label></div>';
return $this->toHtmlString('<div class="'.$type.'"><label>'.$checkAble.' '.$label.'</label></div>');
}

/**
Expand All @@ -334,11 +334,11 @@ private function wrapCheckable($label, $type, $checkAble)
* @param mixed $label
* @param string $type
* @param string $checkAble
* @return string
* @return \Illuminate\Support\HtmlString
*/
private function wrapInlineCheckable($label, $type, $checkAble)
{
return '<div class="'.$type.'-inline">'.$checkAble.' '.$label.'</div>';
return $this->toHtmlString('<div class="'.$type.'-inline">'.$checkAble.' '.$label.'</div>');
}

}

0 comments on commit 6423c68

Please sign in to comment.