@@ -28,7 +28,9 @@ |
||
| 28 | 28 | |
| 29 | 29 | public function getMedia(HasAsset $model = null, ?string $locale = null) |
| 30 | 30 | { |
| 31 | - if(!$model) return []; |
|
| 31 | + if(!$model) { |
|
| 32 | + return []; |
|
| 33 | + } |
|
| 32 | 34 | |
| 33 | 35 | $files = []; |
| 34 | 36 | $locale = $locale ?? app()->getLocale(); |
@@ -265,7 +265,9 @@ |
||
| 265 | 265 | { |
| 266 | 266 | return function (Model $model = null, $locale = null) { |
| 267 | 267 | |
| 268 | - if($this->value) return $this->value; |
|
| 268 | + if($this->value) { |
|
| 269 | + return $this->value; |
|
| 270 | + } |
|
| 269 | 271 | |
| 270 | 272 | if (!$model) { |
| 271 | 273 | return $this->default; |
@@ -32,7 +32,9 @@ |
||
| 32 | 32 | |
| 33 | 33 | public function getMedia(HasAsset $model = null, ?string $locale = null) |
| 34 | 34 | { |
| 35 | - if(!$model) return []; |
|
| 35 | + if(!$model) { |
|
| 36 | + return []; |
|
| 37 | + } |
|
| 36 | 38 | |
| 37 | 39 | $images = []; |
| 38 | 40 | $locale = $locale ?? app()->getLocale(); |
@@ -113,7 +113,9 @@ |
||
| 113 | 113 | $value = $this->dynamic($key); |
| 114 | 114 | |
| 115 | 115 | // If value is localized, we wont return the entire value, but instead return null since no fallback will be provided. |
| 116 | - if(is_array($value) && in_array($locale, $this->dynamicLocales())) return null; |
|
| 116 | + if(is_array($value) && in_array($locale, $this->dynamicLocales())) { |
|
| 117 | + return null; |
|
| 118 | + } |
|
| 117 | 119 | |
| 118 | 120 | return $value; |
| 119 | 121 | } |
@@ -16,7 +16,9 @@ |
||
| 16 | 16 | |
| 17 | 17 | public static function fromRawValue($value): self |
| 18 | 18 | { |
| 19 | - if($value instanceof self) return $value; |
|
| 19 | + if($value instanceof self) { |
|
| 20 | + return $value; |
|
| 21 | + } |
|
| 20 | 22 | |
| 21 | 23 | $value = is_null($value) ? [] : (is_array($value) ? $value : json_decode($value, true)); |
| 22 | 24 | |
@@ -63,7 +63,9 @@ discard block |
||
| 63 | 63 | ->localizedFormat(':name.:locale') |
| 64 | 64 | ->valueResolver(function($model = null, $locale = null, $field) use($fragment){ |
| 65 | 65 | |
| 66 | - if(isset($field->value)) return $field->value; |
|
| 66 | + if(isset($field->value)) { |
|
| 67 | + return $field->value; |
|
| 68 | + } |
|
| 67 | 69 | |
| 68 | 70 | if($field instanceof MediaField){ |
| 69 | 71 | if(!$fragment->hasModelId()){ |
@@ -83,7 +85,9 @@ discard block |
||
| 83 | 85 | |
| 84 | 86 | public function getDuplicatableFields(): array |
| 85 | 87 | { |
| 86 | - if(count($this->getFragments()) < 1) return []; |
|
| 88 | + if(count($this->getFragments()) < 1) { |
|
| 89 | + return []; |
|
| 90 | + } |
|
| 87 | 91 | |
| 88 | 92 | // Take the fields from the first fragment as a starting point for duplication |
| 89 | 93 | return array_map(function(\Thinktomorrow\Chief\Fields\Types\Field $field){ |