Conditions | 3 |
Paths | 4 |
Total Lines | 20 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
19 | public function toArray(Request $request): array |
||
20 | { |
||
21 | /** @var MetaBox $this */ |
||
22 | |||
23 | $metaValueCustom = count($this->meta_value) == 1 |
||
24 | ? $this->meta_value[0] |
||
25 | : $this->meta_value; |
||
26 | $reference = $this->reference; |
||
27 | |||
28 | if (is_array($metaValueCustom)) { |
||
29 | $metaValueCustom['seo_title'] = $metaValueCustom['seo_title'] ?? substr($reference->name, 0, 65) ?? null; |
||
30 | $metaValueCustom['seo_description'] = $metaValueCustom['seo_description'] |
||
31 | ?? substr($reference->description, 0, 300) |
||
32 | ?? null; |
||
33 | } |
||
34 | |||
35 | return [ |
||
36 | 'meta_key' => $this->meta_key, |
||
37 | 'meta_value' => $this->meta_value, |
||
38 | 'meta_value_custom' => $metaValueCustom, |
||
39 | //'reference_id' => $this->reference_id, |
||
44 |