Skip to content

Commit b5066b7

Browse files
committed
BaseTrait for DE
1 parent a98604d commit b5066b7

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

Ajax/semantic/html/base/traits/AttachedTrait.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Ajax\semantic\html\base\constants\Side;
66
use Ajax\semantic\html\base\HtmlSemDoubleElement;
7+
use Ajax\common\html\HtmlDoubleElement;
78

89
trait AttachedTrait {
910
abstract public function addToPropertyCtrl($name, $value, $typeCtrl);
@@ -12,8 +13,8 @@ abstract public function addToPropertyCtrl($name, $value, $typeCtrl);
1213
* @param string $side
1314
* @return HtmlSemDoubleElement
1415
*/
15-
public function setAttachment(HtmlSemDoubleElement $toElement=NULL, $side=Side::BOTH) {
16-
if (isset($toElement)) {
16+
public function setAttachment(HtmlDoubleElement $toElement=NULL, $side=Side::BOTH) {
17+
if (isset($toElement) && \method_exists($toElement, "setAttached")) {
1718
$toElement->setAttached(true);
1819
}
1920
return $this->addToPropertyCtrl("class", $side . " attached", Side::getConstantValues("attached"));

Ajax/semantic/widgets/base/FieldAsTrait.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use Ajax\semantic\html\elements\HtmlFlag;
2121
use Ajax\common\html\BaseHtml;
2222
use Ajax\semantic\html\collections\form\HtmlFormField;
23+
use Ajax\semantic\html\collections\form\HtmlFormRadio;
2324

2425
/**
2526
* trait used in Widget
@@ -160,7 +161,7 @@ public function fieldAsAvatar($index,$attributes=NULL){
160161

161162
public function fieldAsRadio($index,$attributes=NULL){
162163
return $this->_fieldAs(function($id,$name,$value) use($attributes){
163-
$input= new HtmlRadio($id,$name,$value,$value);
164+
$input= new HtmlFormRadio($id,$name,$value,$value);
164165
return $this->_prepareFormFields($input, $name, $attributes);
165166
}, $index,$attributes,"radio");
166167
}

Ajax/semantic/widgets/dataelement/DataElement.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Ajax\JsUtils;
88
use Ajax\service\JArray;
99
use Ajax\semantic\html\collections\table\HtmlTable;
10+
use Ajax\semantic\html\base\traits\BaseTrait;
1011

1112
/**
1213
* DataElement widget for displaying an instance of model
@@ -16,6 +17,7 @@
1617
*
1718
*/
1819
class DataElement extends Widget {
20+
use BaseTrait;
1921
protected $_colWidths;
2022

2123
public function __construct($identifier, $modelInstance=NULL) {

0 commit comments

Comments
 (0)