@@ -44,6 +44,11 @@ discard block |
||
| 44 | 44 | $this->show($modelInstance); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | + /** |
|
| 48 | + * @param InstanceViewer $instanceViewer |
|
| 49 | + * @param string $contentKey |
|
| 50 | + * @param boolean $edition |
|
| 51 | + */ |
|
| 47 | 52 | protected function _init($instanceViewer,$contentKey,$content,$edition){ |
| 48 | 53 | $this->_instanceViewer=$instanceViewer; |
| 49 | 54 | $this->content=[$contentKey=>$content]; |
@@ -96,16 +101,26 @@ discard block |
||
| 96 | 101 | return $this; |
| 97 | 102 | } |
| 98 | 103 | |
| 104 | + /** |
|
| 105 | + * @param \Closure $field |
|
| 106 | + */ |
|
| 99 | 107 | public function addField($field){ |
| 100 | 108 | $this->_instanceViewer->addField($field); |
| 101 | 109 | return $this; |
| 102 | 110 | } |
| 103 | 111 | |
| 112 | + /** |
|
| 113 | + * @param integer $index |
|
| 114 | + * @param \Closure $field |
|
| 115 | + */ |
|
| 104 | 116 | public function insertField($index,$field){ |
| 105 | 117 | $this->_instanceViewer->insertField($index, $field); |
| 106 | 118 | return $this; |
| 107 | 119 | } |
| 108 | 120 | |
| 121 | + /** |
|
| 122 | + * @param \Closure $field |
|
| 123 | + */ |
|
| 109 | 124 | public function insertInField($index,$field){ |
| 110 | 125 | $this->_instanceViewer->insertInField($index, $field); |
| 111 | 126 | return $this; |
@@ -45,6 +45,9 @@ discard block |
||
| 45 | 45 | return $value; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | + /** |
|
| 49 | + * @param integer $index |
|
| 50 | + */ |
|
| 48 | 51 | public function getValue($index){ |
| 49 | 52 | $property=$this->properties[$index]; |
| 50 | 53 | return $this->_getValue($property, $index); |
@@ -54,6 +57,9 @@ discard block |
||
| 54 | 57 | |
| 55 | 58 | } |
| 56 | 59 | |
| 60 | + /** |
|
| 61 | + * @param string $name |
|
| 62 | + */ |
|
| 57 | 63 | protected function _getDefaultValue($name,$value,$index){ |
| 58 | 64 | $func=$this->defaultValueFunction; |
| 59 | 65 | return $func($name,$value,$index); |
@@ -197,6 +203,9 @@ discard block |
||
| 197 | 203 | return $this; |
| 198 | 204 | } |
| 199 | 205 | |
| 206 | + /** |
|
| 207 | + * @param integer $index |
|
| 208 | + */ |
|
| 200 | 209 | public static function setIndex($index) { |
| 201 | 210 | self::$index=$index; |
| 202 | 211 | } |
@@ -255,7 +264,7 @@ discard block |
||
| 255 | 264 | * The $callback function can take the following arguments : $field=>the compiled field, $instance : the active instance of the object, $index: the field position |
| 256 | 265 | * @param int $index postion of the compiled field |
| 257 | 266 | * @param callable $callback function called after the field compilation |
| 258 | - * @return \Ajax\semantic\widgets\datatable\InstanceViewer |
|
| 267 | + * @return InstanceViewer |
|
| 259 | 268 | */ |
| 260 | 269 | public function afterCompile($index,$callback){ |
| 261 | 270 | $this->afterCompile[$index]=$callback; |
@@ -273,6 +282,9 @@ discard block |
||
| 273 | 282 | return $this; |
| 274 | 283 | } |
| 275 | 284 | |
| 285 | + /** |
|
| 286 | + * @param callable $defaultValueFunction |
|
| 287 | + */ |
|
| 276 | 288 | public function setDefaultValueFunction($defaultValueFunction) { |
| 277 | 289 | $this->defaultValueFunction=$defaultValueFunction; |
| 278 | 290 | return $this; |
@@ -17,7 +17,14 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | trait FormFieldAsTrait{ |
| 19 | 19 | |
| 20 | + /** |
|
| 21 | + * @param string $prefix |
|
| 22 | + */ |
|
| 20 | 23 | abstract protected function _getFieldIdentifier($prefix); |
| 24 | + |
|
| 25 | + /** |
|
| 26 | + * @param \Closure $callback |
|
| 27 | + */ |
|
| 21 | 28 | abstract public function setValueFunction($index,$callback); |
| 22 | 29 | abstract protected function _applyAttributes($element,&$attributes,$index); |
| 23 | 30 | |
@@ -38,6 +45,10 @@ discard block |
||
| 38 | 45 | } |
| 39 | 46 | } |
| 40 | 47 | |
| 48 | + /** |
|
| 49 | + * @param \Closure $elementCallback |
|
| 50 | + * @param string $identifier |
|
| 51 | + */ |
|
| 41 | 52 | protected function _fieldAs($elementCallback,$index,$attributes=NULL,$identifier=null){ |
| 42 | 53 | $this->setValueFunction($index,function($value) use ($index,&$attributes,$elementCallback){ |
| 43 | 54 | $caption=$this->_instanceViewer->getCaption($index); |