This repository has been archived by the owner on Feb 26, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finished first of horizontal form builder
- Loading branch information
1 parent
c415af7
commit ef4cdc4
Showing
14 changed files
with
1,030 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php namespace AdamWathan\BootForms\Elements; | ||
|
||
use AdamWathan\Form\Elements\Element; | ||
use AdamWathan\Form\Elements\Label; | ||
|
||
class CheckGroup extends FormGroup | ||
{ | ||
public function __construct(Label $label) | ||
{ | ||
$this->label = $label; | ||
} | ||
|
||
public function render() | ||
{ | ||
$html = '<div'; | ||
$html .= $this->renderAttributes(); | ||
$html .= '>'; | ||
$html .= $this->label; | ||
$html .= $this->renderHelpBlock(); | ||
|
||
$html .= '</div>'; | ||
|
||
return $html; | ||
} | ||
|
||
public function __call($method, $parameters) | ||
{ | ||
call_user_func_array(array($this->label->getControl(), $method), $parameters); | ||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php namespace AdamWathan\BootForms\Elements; | ||
|
||
use AdamWathan\Form\Elements\Element; | ||
|
||
class HelpBlock extends Element | ||
{ | ||
private $message; | ||
|
||
public function __construct($message) | ||
{ | ||
$this->message = $message; | ||
$this->addClass('help-block'); | ||
} | ||
|
||
public function render() | ||
{ | ||
$html = '<p'; | ||
$html .= $this->renderAttributes(); | ||
$html .= '>'; | ||
$html .= $this->message; | ||
$html .= '</p>'; | ||
|
||
return $html; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php namespace AdamWathan\BootForms\Elements; | ||
|
||
use AdamWathan\Form\Elements\Element; | ||
use AdamWathan\Form\Elements\Label; | ||
|
||
class HorizontalFormGroup extends FormGroup | ||
{ | ||
protected $controlWidth; | ||
|
||
public function __construct(Label $label, Element $control, $controlWidth = 10) | ||
{ | ||
parent::__construct($label, $control); | ||
$this->controlWidth = $controlWidth; | ||
} | ||
|
||
public function render() | ||
{ | ||
$html = '<div'; | ||
$html .= $this->renderAttributes(); | ||
$html .= '>'; | ||
$html .= $this->label; | ||
$html .= '<div class="' . $this->getControlClass() . '">'; | ||
$html .= $this->control; | ||
$html .= $this->renderHelpBlock(); | ||
$html .= '</div>'; | ||
|
||
$html .= '</div>'; | ||
|
||
return $html; | ||
} | ||
|
||
public function setControlWidth($width) | ||
{ | ||
$this->controlWidth = $width; | ||
return $this; | ||
} | ||
|
||
protected function getControlClass() | ||
{ | ||
return 'col-lg-' . $this->controlWidth; | ||
} | ||
|
||
public function __call($method, $parameters) | ||
{ | ||
call_user_func_array(array($this->control, $method), $parameters); | ||
return $this; | ||
} | ||
} |
Oops, something went wrong.