Skip to content

Commit 2383494

Browse files
committed
labeledCheckbox with inputs
1 parent 2ffc140 commit 2383494

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

Ajax/semantic/html/collections/form/traits/FieldTrait.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
use Ajax\semantic\html\elements\HtmlButton;
77
use Ajax\semantic\html\base\constants\Direction;
88
use Ajax\semantic\html\base\constants\State;
9+
use Ajax\semantic\html\modules\checkbox\HtmlCheckbox;
10+
use Ajax\common\html\BaseHtml;
11+
use Ajax\semantic\html\elements\HtmlLabel;
912

1013
/**
1114
* @author jc
@@ -31,17 +34,46 @@ public function addLoading() {
3134
return $this->addToProperty("class", State::LOADING);
3235
}
3336

37+
/**
38+
* @param string|BaseHtml $label
39+
* @param string $direction
40+
* @param string $icon
41+
* @return HtmlLabel
42+
*/
3443
public function labeled($label, $direction=Direction::LEFT, $icon=NULL) {
3544
$field=$this->getField();
3645
$labelO=$field->addLabel($label,$direction===Direction::LEFT,$icon);
3746
$field->addToProperty("class", $direction . " labeled");
3847
return $labelO;
3948
}
4049

50+
/**
51+
* @param string $direction
52+
* @param string $caption
53+
* @param string $value
54+
* @param string $checkboxType
55+
* @return HtmlLabel
56+
*/
57+
public function labeledCheckbox($direction=Direction::LEFT,$caption="",$value=NULL,$checkboxType=NULL){
58+
return $this->labeled(new HtmlCheckbox("lbl-ck-".$this->getField()->getIdentifier(),$caption,$value,$checkboxType),$direction);
59+
}
60+
61+
/**
62+
* @param string $icon
63+
* @param string $direction
64+
* @return HtmlLabel
65+
*/
4166
public function labeledToCorner($icon, $direction=Direction::LEFT) {
4267
return $this->labeled("", $direction . " corner", $icon)->toCorner($direction);
4368
}
4469

70+
/**
71+
* @param string $action
72+
* @param string $direction
73+
* @param string $icon
74+
* @param string $labeled
75+
* @return unknown|HtmlButton
76+
*/
4577
public function addAction($action, $direction=Direction::RIGHT, $icon=NULL, $labeled=false) {
4678
$field=$this->getField();
4779
$actionO=$action;
@@ -55,6 +87,12 @@ public function addAction($action, $direction=Direction::RIGHT, $icon=NULL, $lab
5587
return $actionO;
5688
}
5789

90+
/**
91+
* @param string $label
92+
* @param array $items
93+
* @param string $direction
94+
* @return HtmlLabel
95+
*/
5896
public function addDropdown($label="", $items=array(),$direction=Direction::RIGHT){
5997
$labelO=new HtmlDropdown("dd-".$this->identifier,$label,$items);
6098
$labelO->asSelect("select-".$this->identifier,false,true);

0 commit comments

Comments
 (0)