@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); |
117 | 117 | |
118 | 118 | // Load object |
119 | -include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals |
|
119 | +include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals |
|
120 | 120 | include DOL_DOCUMENT_ROOT . '/core/actions_dellink.inc.php'; |
121 | 121 | |
122 | 122 | // Initialize technical object to manage hooks of modules. Note that conf->hooks_modules contains array array |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | |
143 | 143 | $parameters = array(); |
144 | 144 | $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, |
145 | - $action); // Note that $action and $object may have been modified by some hooks |
|
145 | + $action); // Note that $action and $object may have been modified by some hooks |
|
146 | 146 | if ($reshook < 0) { |
147 | 147 | setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
148 | 148 | } |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | print '<div class="tabsAction">' . "\n"; |
527 | 527 | $parameters = array(); |
528 | 528 | $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, |
529 | - $action); // Note that $action and $object may have been modified by hook |
|
529 | + $action); // Note that $action and $object may have been modified by hook |
|
530 | 530 | if ($reshook < 0) { |
531 | 531 | setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
532 | 532 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | */ |
52 | 52 | private function renderElement(FormElementInterface $element) |
53 | 53 | { |
54 | - switch($element->getType()){ |
|
54 | + switch ($element->getType()) { |
|
55 | 55 | case FormElementInterface::TYPE_TEXTAREA: |
56 | 56 | return sprintf('<textarea name="%s" %s>%s</textarea>', $element->getName(), $this->formatOptions($element->getOptions()), $element->getValue()); |
57 | 57 | |
@@ -97,14 +97,14 @@ discard block |
||
97 | 97 | { |
98 | 98 | $selectElement = sprintf('<select name="%s" >', $element->getName()); |
99 | 99 | |
100 | - if($element->getValueOptions()){ |
|
101 | - foreach($element->getValueOptions() as $optionValue => $optionLabel){ |
|
100 | + if ($element->getValueOptions()) { |
|
101 | + foreach ($element->getValueOptions() as $optionValue => $optionLabel) { |
|
102 | 102 | $selectedAttribute = $optionValue === $element->getValue() ? 'selected' : ''; |
103 | 103 | $selectElement .= sprintf('<option value="%s" %s >%s</option>', $optionValue, $selectedAttribute, $optionLabel); |
104 | 104 | } |
105 | 105 | } |
106 | 106 | |
107 | - $selectElement.='</select>'; |
|
107 | + $selectElement .= '</select>'; |
|
108 | 108 | |
109 | 109 | return $selectElement; |
110 | 110 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | /** |
103 | 103 | * @return $this |
104 | 104 | */ |
105 | - public function required(){ |
|
105 | + public function required() { |
|
106 | 106 | $this->options['attr']['required'] = 'required'; |
107 | 107 | |
108 | 108 | return $this; |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | /** |
112 | 112 | * @return $this |
113 | 113 | */ |
114 | - public function disable(){ |
|
114 | + public function disable() { |
|
115 | 115 | $this->options['attr']['disabled'] = 'disabled'; |
116 | 116 | return $this; |
117 | 117 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | /** |
79 | 79 | * @inheritDoc |
80 | 80 | */ |
81 | - public function getOptions(){ |
|
81 | + public function getOptions() { |
|
82 | 82 | return $this->options; |
83 | 83 | } |
84 | 84 | |
@@ -98,11 +98,11 @@ discard block |
||
98 | 98 | */ |
99 | 99 | public function validate() |
100 | 100 | { |
101 | - if(!$this->validator){ |
|
101 | + if (!$this->validator) { |
|
102 | 102 | return true; |
103 | 103 | } |
104 | 104 | |
105 | - if(null === $this->object){ |
|
105 | + if (null === $this->object) { |
|
106 | 106 | throw new \InvalidArgumentException('Object not bind'); |
107 | 107 | } |
108 | 108 | |
@@ -126,10 +126,10 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public function bind($object) |
128 | 128 | { |
129 | - foreach($this->elements as $element){ |
|
129 | + foreach ($this->elements as $element) { |
|
130 | 130 | $name = $this->camelCase($element->getName()); |
131 | - $methodName = 'get'.$name; |
|
132 | - if(!method_exists($object, $methodName)){ |
|
131 | + $methodName = 'get' . $name; |
|
132 | + if (!method_exists($object, $methodName)) { |
|
133 | 133 | continue; |
134 | 134 | } |
135 | 135 | |
@@ -146,15 +146,15 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public function setData(array $data) |
148 | 148 | { |
149 | - foreach($data as $fieldName => $currentData){ |
|
150 | - if(!key_exists($fieldName, $this->elements)){ |
|
149 | + foreach ($data as $fieldName => $currentData) { |
|
150 | + if (!key_exists($fieldName, $this->elements)) { |
|
151 | 151 | continue; |
152 | 152 | } |
153 | 153 | |
154 | 154 | $this->elements[$fieldName]->setValue($currentData); |
155 | 155 | |
156 | - $methodName = 'set'.$this->camelCase($fieldName); |
|
157 | - if(null === $this->object || !method_exists($this->object, $methodName)){ |
|
156 | + $methodName = 'set' . $this->camelCase($fieldName); |
|
157 | + if (null === $this->object || !method_exists($this->object, $methodName)) { |
|
158 | 158 | continue; |
159 | 159 | } |
160 | 160 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | */ |
178 | 178 | public function getElement($elementName) |
179 | 179 | { |
180 | - if(!key_exists($elementName, $this->elements)){ |
|
180 | + if (!key_exists($elementName, $this->elements)) { |
|
181 | 181 | throw new \InvalidArgumentException(sprintf('Element %s not found ', $elementName)); |
182 | 182 | } |
183 | 183 |