@@ -57,6 +57,11 @@ discard block |
||
| 57 | 57 | $this->show($modelInstance); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | + /** |
|
| 61 | + * @param InstanceViewer $instanceViewer |
|
| 62 | + * @param string $contentKey |
|
| 63 | + * @param boolean $edition |
|
| 64 | + */ |
|
| 60 | 65 | protected function _init($instanceViewer,$contentKey,$content,$edition){ |
| 61 | 66 | $this->_instanceViewer=$instanceViewer; |
| 62 | 67 | $this->content=[$contentKey=>$content]; |
@@ -117,6 +122,9 @@ discard block |
||
| 117 | 122 | return $this; |
| 118 | 123 | } |
| 119 | 124 | |
| 125 | + /** |
|
| 126 | + * @param \Closure $field |
|
| 127 | + */ |
|
| 120 | 128 | public function addField($field){ |
| 121 | 129 | $this->_instanceViewer->addField($field); |
| 122 | 130 | return $this; |
@@ -132,11 +140,18 @@ discard block |
||
| 132 | 140 | return $this->addMessage(["error"=>true],"message"); |
| 133 | 141 | } |
| 134 | 142 | |
| 143 | + /** |
|
| 144 | + * @param integer $index |
|
| 145 | + * @param \Closure $field |
|
| 146 | + */ |
|
| 135 | 147 | public function insertField($index,$field){ |
| 136 | 148 | $this->_instanceViewer->insertField($index, $field); |
| 137 | 149 | return $this; |
| 138 | 150 | } |
| 139 | 151 | |
| 152 | + /** |
|
| 153 | + * @param \Closure $field |
|
| 154 | + */ |
|
| 140 | 155 | public function insertInField($index,$field){ |
| 141 | 156 | $this->_instanceViewer->insertInField($index, $field); |
| 142 | 157 | return $this; |
@@ -26,9 +26,18 @@ discard block |
||
| 26 | 26 | trait FieldAsTrait{ |
| 27 | 27 | |
| 28 | 28 | abstract protected function _getFieldIdentifier($prefix,$name=""); |
| 29 | + |
|
| 30 | + /** |
|
| 31 | + * @param \Closure $callback |
|
| 32 | + */ |
|
| 29 | 33 | abstract public function setValueFunction($index,$callback); |
| 30 | 34 | abstract protected function _getFieldName($index); |
| 31 | 35 | abstract protected function _getFieldCaption($index); |
| 36 | + |
|
| 37 | + /** |
|
| 38 | + * @param HtmlButton $button |
|
| 39 | + * @param string $event |
|
| 40 | + */ |
|
| 32 | 41 | abstract protected function _buttonAsSubmit(&$button,$event,$url,$responseElement=NULL); |
| 33 | 42 | |
| 34 | 43 | /** |
@@ -65,12 +74,19 @@ discard block |
||
| 65 | 74 | } |
| 66 | 75 | } |
| 67 | 76 | |
| 77 | + /** |
|
| 78 | + * @param HtmlFormInput $field |
|
| 79 | + */ |
|
| 68 | 80 | protected function _prepareFormFields(&$field,$name,&$attributes){ |
| 69 | 81 | $field->setName($name); |
| 70 | 82 | $this->_addRules($field, $attributes); |
| 71 | 83 | return $field; |
| 72 | 84 | } |
| 73 | 85 | |
| 86 | + /** |
|
| 87 | + * @param \Closure $elementCallback |
|
| 88 | + * @param string $prefix |
|
| 89 | + */ |
|
| 74 | 90 | protected function _fieldAs($elementCallback,$index,$attributes=NULL,$prefix=null){ |
| 75 | 91 | $this->setValueFunction($index,function($value) use ($index,&$attributes,$elementCallback,$prefix){ |
| 76 | 92 | $caption=$this->_getFieldCaption($index); |
@@ -221,6 +237,9 @@ discard block |
||
| 221 | 237 | } |
| 222 | 238 | } |
| 223 | 239 | |
| 240 | + /** |
|
| 241 | + * @param integer $index |
|
| 242 | + */ |
|
| 224 | 243 | public function fieldAs($index,$type,$attributes=NULL){ |
| 225 | 244 | $method="fieldAs".\ucfirst($type); |
| 226 | 245 | if(\method_exists($this, $method)){ |