@@ -11,12 +11,12 @@ |
||
| 11 | 11 | public function hydrateHandleRevisions($object, $fields) |
| 12 | 12 | { |
| 13 | 13 | // HandleRepeaters trait => getRepeaters |
| 14 | - foreach($this->getRepeaters() as $repeater) { |
|
| 14 | + foreach ($this->getRepeaters() as $repeater) { |
|
| 15 | 15 | $this->hydrateRepeater($object, $fields, $repeater['relation'], $repeater['model']); |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | // HandleBrowers trait => getBrowsers |
| 19 | - foreach($this->getBrowsers() as $browser) { |
|
| 19 | + foreach ($this->getBrowsers() as $browser) { |
|
| 20 | 20 | $this->hydrateBrowser($object, $fields, $browser['relation'], $browser['positionAttribute'], $browser['model']); |
| 21 | 21 | } |
| 22 | 22 | |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | $fields = $this->getRelatedElementsAsCollection($object, $relation); |
| 153 | 153 | |
| 154 | 154 | if ($fields->isNotEmpty()) { |
| 155 | - return $fields->map(function ($relatedElement) use ($titleKey, $routePrefix, $relation, $moduleName) { |
|
| 155 | + return $fields->map(function($relatedElement) use ($titleKey, $routePrefix, $relation, $moduleName) { |
|
| 156 | 156 | return [ |
| 157 | 157 | 'id' => $relatedElement->id, |
| 158 | 158 | 'name' => $relatedElement->titleInBrowser ?? $relatedElement->$titleKey, |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | */ |
| 175 | 175 | public function getFormFieldsForRelatedBrowser($object, $relation, $titleKey = 'title') |
| 176 | 176 | { |
| 177 | - return $object->getRelated($relation)->map(function ($relatedElement) use ($titleKey) { |
|
| 177 | + return $object->getRelated($relation)->map(function($relatedElement) use ($titleKey) { |
|
| 178 | 178 | return ($relatedElement != null) ? [ |
| 179 | 179 | 'id' => $relatedElement->id, |
| 180 | 180 | 'name' => $relatedElement->titleInBrowser ?? $relatedElement->$titleKey, |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | ]) + (classHasTrait($relatedElement, HasMedias::class) ? [ |
| 185 | 185 | 'thumbnail' => $relatedElement->defaultCmsImage(['w' => 100, 'h' => 100]), |
| 186 | 186 | ] : []) : []; |
| 187 | - })->reject(function ($item) { |
|
| 187 | + })->reject(function($item) { |
|
| 188 | 188 | return empty($item); |
| 189 | 189 | })->values()->toArray(); |
| 190 | 190 | } |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | */ |
| 198 | 198 | protected function getBrowsers() |
| 199 | 199 | { |
| 200 | - return collect($this->browsers)->map(function ($browser, $key) { |
|
| 200 | + return collect($this->browsers)->map(function($browser, $key) { |
|
| 201 | 201 | $browserName = is_string($browser) ? $browser : $key; |
| 202 | 202 | $moduleName = !empty($browser['moduleName']) ? $browser['moduleName'] : $this->inferModuleNameFromBrowserName($browserName); |
| 203 | 203 | |
@@ -19,17 +19,17 @@ |
||
| 19 | 19 | public function renderNamedBlocks($name = 'default', $renderChilds = true, $blockViewMappings = [], $data = []) |
| 20 | 20 | { |
| 21 | 21 | return $this->blocks |
| 22 | - ->filter(function ($block) use ($name) { |
|
| 22 | + ->filter(function($block) use ($name) { |
|
| 23 | 23 | return $name === 'default' |
| 24 | 24 | ? ($block->editor_name === $name || $block->editor_name === null) |
| 25 | 25 | : $block->editor_name === $name; |
| 26 | 26 | }) |
| 27 | 27 | ->where('parent_id', null) |
| 28 | - ->map(function ($block) use ($blockViewMappings, $renderChilds, $data) { |
|
| 28 | + ->map(function($block) use ($blockViewMappings, $renderChilds, $data) { |
|
| 29 | 29 | if ($renderChilds) { |
| 30 | 30 | $childBlocks = $this->blocks->where('parent_id', $block->id); |
| 31 | 31 | |
| 32 | - $renderedChildViews = $childBlocks->map(function ($childBlock) use ($blockViewMappings, $data) { |
|
| 32 | + $renderedChildViews = $childBlocks->map(function($childBlock) use ($blockViewMappings, $data) { |
|
| 33 | 33 | $view = $this->getBlockView($childBlock->type, $blockViewMappings); |
| 34 | 34 | return view($view, $data)->with('block', $childBlock)->render(); |
| 35 | 35 | })->implode(''); |
@@ -34,8 +34,7 @@ |
||
| 34 | 34 | public function scopeEditor($query, $name = 'default') |
| 35 | 35 | { |
| 36 | 36 | return $name === 'default' ? |
| 37 | - $query->where('editor_name', $name)->orWhereNull('editor_name') : |
|
| 38 | - $query->where('editor_name', $name); |
|
| 37 | + $query->where('editor_name', $name)->orWhereNull('editor_name') : $query->where('editor_name', $name); |
|
| 39 | 38 | } |
| 40 | 39 | |
| 41 | 40 | public function blockable() |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | $this->isNewFormat = $this->isNewFormat($contents); |
| 205 | 205 | $this->contents = $contents; |
| 206 | 206 | |
| 207 | - $this->parseMixedProperty('titleField', $contents, $this->name, function ($value, $options) { |
|
| 207 | + $this->parseMixedProperty('titleField', $contents, $this->name, function($value, $options) { |
|
| 208 | 208 | $this->titleField = $value; |
| 209 | 209 | $this->hideTitlePrefix = (boolean) ($options['hidePrefix'] ?? false); |
| 210 | 210 | }); |
@@ -311,14 +311,14 @@ discard block |
||
| 311 | 311 | return $value; |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | - if ($configBlock = collect(config("twill.block_editor.blocks"))->filter(function ($block) use ($blockName) { |
|
| 314 | + if ($configBlock = collect(config("twill.block_editor.blocks"))->filter(function($block) use ($blockName) { |
|
| 315 | 315 | return Str::contains($block['component'], $blockName); |
| 316 | 316 | })->first()) { |
| 317 | 317 | if ($value = ($configBlock[$property] ?? null)) { |
| 318 | 318 | return $value; |
| 319 | 319 | } |
| 320 | 320 | } |
| 321 | - if ($configRepeater = collect(config("twill.block_editor.repeaters"))->filter(function ($repeater) use ($blockName) { |
|
| 321 | + if ($configRepeater = collect(config("twill.block_editor.repeaters"))->filter(function($repeater) use ($blockName) { |
|
| 322 | 322 | return Str::contains($repeater['component'], $blockName); |
| 323 | 323 | })->first()) { |
| 324 | 324 | if ($value = ($configRepeater[$property] ?? null)) { |