@@ -118,11 +118,13 @@ discard block |
||
| 118 | 118 | $defaults['type'] = $params['type']; |
| 119 | 119 | // path to the file is determined by the theme hierarchy |
| 120 | 120 | $defaults['file'] = $params['type'] . '.tpl'; |
| 121 | - if (isset($params['key'])) |
|
| 122 | - self::buildDataFromCmsKeyAttributes($params); |
|
| 121 | + if (isset($params['key'])) { |
|
| 122 | + self::buildDataFromCmsKeyAttributes($params); |
|
| 123 | + } |
|
| 123 | 124 | } |
| 124 | - if (isset($params['dds']) || isset($params['dds_page']) || isset($params['dds_class'])) |
|
| 125 | - Daedalus::buildDataFromDdsAttributes($params); |
|
| 125 | + if (isset($params['dds']) || isset($params['dds_page']) || isset($params['dds_class'])) { |
|
| 126 | + Daedalus::buildDataFromDdsAttributes($params); |
|
| 127 | + } |
|
| 126 | 128 | $resolvedParams = Arr::merge($defaults, $params); |
| 127 | 129 | return $widget->render($resolvedParams, $template); |
| 128 | 130 | } |
@@ -169,8 +171,9 @@ discard block |
||
| 169 | 171 | } |
| 170 | 172 | // scb = static content block |
| 171 | 173 | $params['type'] = '_scb'; |
| 172 | - if (isset($params['key'])) |
|
| 173 | - self::buildDataFromCmsKeyAttributes($params); |
|
| 174 | + if (isset($params['key'])) { |
|
| 175 | + self::buildDataFromCmsKeyAttributes($params); |
|
| 176 | + } |
|
| 174 | 177 | $params['content'] = $content; |
| 175 | 178 | $params['wys'] = (isset($params['wys']) ? $params['wys'] : true); |
| 176 | 179 | return $widget->render($params, $template); |
@@ -206,8 +209,9 @@ discard block |
||
| 206 | 209 | $data = []; |
| 207 | 210 | if (($dataRequest = $this->getDataRequest()) !== null) { |
| 208 | 211 | $id = $meta = null; |
| 209 | - if (!$this->getPage()->requestWidgetData($dataRequest, $data, $id, $this->isStatic, $meta)) |
|
| 210 | - return $id; |
|
| 212 | + if (!$this->getPage()->requestWidgetData($dataRequest, $data, $id, $this->isStatic, $meta)) { |
|
| 213 | + return $id; |
|
| 214 | + } |
|
| 211 | 215 | $this->saveData($data); |
| 212 | 216 | $this->saveDataMetaInformation($meta); |
| 213 | 217 | } |
@@ -244,8 +248,9 @@ discard block |
||
| 244 | 248 | $this->params['meta'] = $this->meta; |
| 245 | 249 | |
| 246 | 250 | // createTemplate is an expensive call so only call it once per file and reset all variables on the stored template. |
| 247 | - if (!isset($templates[$file])) |
|
| 248 | - $templates[$file] = $this->renderer->createTemplate($file); |
|
| 251 | + if (!isset($templates[$file])) { |
|
| 252 | + $templates[$file] = $this->renderer->createTemplate($file); |
|
| 253 | + } |
|
| 249 | 254 | $tpl = $templates[$file]; |
| 250 | 255 | $tpl->tpl_vars = $tpl->config_vars = []; |
| 251 | 256 | |
@@ -263,8 +268,9 @@ discard block |
||
| 263 | 268 | */ |
| 264 | 269 | protected function getDataRequest() |
| 265 | 270 | { |
| 266 | - if (isset($this->params['data'])) |
|
| 267 | - return Daedalus::convertDataRequestToJson($this->params['data']); |
|
| 271 | + if (isset($this->params['data'])) { |
|
| 272 | + return Daedalus::convertDataRequestToJson($this->params['data']); |
|
| 273 | + } |
|
| 268 | 274 | return null; |
| 269 | 275 | } |
| 270 | 276 | |
@@ -320,15 +326,17 @@ discard block |
||
| 320 | 326 | */ |
| 321 | 327 | protected static function buildDataFromCmsKeyAttributes(&$params) |
| 322 | 328 | { |
| 323 | - if (!isset($params['type'], $params['key'])) |
|
| 324 | - return; |
|
| 329 | + if (!isset($params['type'], $params['key'])) { |
|
| 330 | + return; |
|
| 331 | + } |
|
| 325 | 332 | $key = "$params[type]_$params[key]"; |
| 326 | 333 | $pageId = isset($params['page']) ? self::$page->getId() : null; |
| 327 | 334 | $params['data-key'] = $key; |
| 328 | 335 | $params['data-page-id'] = $pageId; |
| 329 | 336 | $params['data'] = "'key':'$key','pageId':'$pageId'"; |
| 330 | - if (!isset($params['content'])) |
|
| 331 | - $params['content'] = "Add Content for $params[key] here"; |
|
| 337 | + if (!isset($params['content'])) { |
|
| 338 | + $params['content'] = "Add Content for $params[key] here"; |
|
| 339 | + } |
|
| 332 | 340 | $params['is_static'] = true; |
| 333 | 341 | } |
| 334 | 342 | |
@@ -344,10 +352,11 @@ discard block |
||
| 344 | 352 | if ($this->getPage()->isInEditMode()) { |
| 345 | 353 | $dataKey = $this->params['data-key']; |
| 346 | 354 | $dataPageId = $this->params['data-page-id']; |
| 347 | - if ((isset($this->params['wys']) || isset($this->params['wysiwyg'])) || (isset($this->params['editor']) && strpos('wys', $this->params['editor'] === 0))) |
|
| 348 | - return '<div id="'.$this->getId().'" data-id="'.$this->getId().'" data-key="'.$dataKey.'" data-page-id="'.$dataPageId.'" class="cobe-editable cobe-static-block" contenteditable="true">' . $value . '</div>'; |
|
| 349 | - else |
|
| 350 | - return "<div style='display:inline-block;' class='cobe-editable cobe-static' data-key='$dataKey' data-page-id='$dataPageId' contenteditable='true' />$value</div>"; |
|
| 355 | + if ((isset($this->params['wys']) || isset($this->params['wysiwyg'])) || (isset($this->params['editor']) && strpos('wys', $this->params['editor'] === 0))) { |
|
| 356 | + return '<div id="'.$this->getId().'" data-id="'.$this->getId().'" data-key="'.$dataKey.'" data-page-id="'.$dataPageId.'" class="cobe-editable cobe-static-block" contenteditable="true">' . $value . '</div>'; |
|
| 357 | + } else { |
|
| 358 | + return "<div style='display:inline-block;' class='cobe-editable cobe-static' data-key='$dataKey' data-page-id='$dataPageId' contenteditable='true' />$value</div>"; |
|
| 359 | + } |
|
| 351 | 360 | } else { |
| 352 | 361 | return $value; |
| 353 | 362 | } |
@@ -129,7 +129,9 @@ |
||
| 129 | 129 | public function getName($idOrUrl) |
| 130 | 130 | { |
| 131 | 131 | if (Hash::isUuid64($idOrUrl)) { |
| 132 | - if (!neon()->firefly->fileManager->exists($idOrUrl)) throw new HttpException(404); |
|
| 132 | + if (!neon()->firefly->fileManager->exists($idOrUrl)) { |
|
| 133 | + throw new HttpException(404); |
|
| 134 | + } |
|
| 133 | 135 | $meta = neon()->firefly->fileManager->getMeta($idOrUrl); |
| 134 | 136 | return $meta['name']; |
| 135 | 137 | } |