@@ -8,10 +8,12 @@ discard block |
||
8 | 8 | |
9 | 9 | class ShortCodeConverter |
10 | 10 | { |
11 | - public static function do($string, $locale = null) |
|
11 | + public static function do { |
|
12 | + ($string, $locale = null) |
|
12 | 13 | { |
13 | 14 | //var_dump($string); exit; |
14 | 15 | if ($locale) setlocale(LC_TIME, self::convertLocale($locale)); |
16 | + } |
|
15 | 17 | |
16 | 18 | //var_dump(self::convertLocale($locale)); exit; |
17 | 19 | //$string = preg_replace('/date\([\'"]?([a-z% ]+)[\'"]?\)/i', strftime(strpos('\1', '%') ? '\1': '%\1'), $string); |
@@ -25,11 +27,13 @@ discard block |
||
25 | 27 | |
26 | 28 | public static function convertLocale($locale) |
27 | 29 | { |
28 | - if ($locale == 'fr') |
|
29 | - return 'fr_FR'; |
|
30 | + if ($locale == 'fr') { |
|
31 | + return 'fr_FR'; |
|
32 | + } |
|
30 | 33 | |
31 | - if ($locale == 'en') |
|
32 | - return 'en_UK'; |
|
34 | + if ($locale == 'en') { |
|
35 | + return 'en_UK'; |
|
36 | + } |
|
33 | 37 | |
34 | 38 | return $locale; |
35 | 39 | } |
@@ -59,12 +59,12 @@ discard block |
||
59 | 59 | // Next : load this from configuration |
60 | 60 | $mainFields = ['h1', 'mainContent', 'mainContentIsMarkdown']; |
61 | 61 | $columnFields = [ |
62 | - 'admin.page.state.label' => ['createdAt', 'metaRobots',], |
|
63 | - 'admin.page.permanlien.label' => ['host', 'slug', 'parentPage',], |
|
64 | - 'admin.page.extended.label' => ['expand' => true, 'fields' => ['mainImage', 'name', 'title', 'excrept',]], |
|
65 | - 'admin.page.translations.label' => [ 'locale', 'translations',], |
|
66 | - 'admin.page.otherProperties.label' => ['expand' => true, 'fields' => ['otherProperties',]], |
|
67 | - 'admin.page.images.label' => ['images',], |
|
62 | + 'admin.page.state.label' => ['createdAt', 'metaRobots', ], |
|
63 | + 'admin.page.permanlien.label' => ['host', 'slug', 'parentPage', ], |
|
64 | + 'admin.page.extended.label' => ['expand' => true, 'fields' => ['mainImage', 'name', 'title', 'excrept', ]], |
|
65 | + 'admin.page.translations.label' => ['locale', 'translations', ], |
|
66 | + 'admin.page.otherProperties.label' => ['expand' => true, 'fields' => ['otherProperties', ]], |
|
67 | + 'admin.page.images.label' => ['images', ], |
|
68 | 68 | ]; |
69 | 69 | |
70 | 70 | $formMapper->with('admin.page.mainContent.label', ['class' => 'col-md-9 mainFields']); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $fields = $block['fields'] ?? $block; |
79 | 79 | $class = isset($block['expand']) ? 'expand' : ''; |
80 | 80 | $formMapper->with($k, ["class" => "col-md-3 columnFields ".$class]); |
81 | - foreach($fields as $field) { |
|
81 | + foreach ($fields as $field) { |
|
82 | 82 | $func = 'configureFormField'.ucfirst($field); |
83 | 83 | $this->$func($formMapper); |
84 | 84 | } |
@@ -108,6 +108,6 @@ |
||
108 | 108 | } |
109 | 109 | |
110 | 110 | public function setPageCanonicalService($pageCanonicalService) { |
111 | - $this->pageCanonicalService = $pageCanonicalService; |
|
111 | + $this->pageCanonicalService = $pageCanonicalService; |
|
112 | 112 | } |
113 | 113 | } |
@@ -138,7 +138,7 @@ |
||
138 | 138 | 'help_html' => true, |
139 | 139 | 'help' => 'admin.page.translations.help', |
140 | 140 | 'btn_add' => false, |
141 | - 'to_string_callback' => function ($entity) { |
|
141 | + 'to_string_callback' => function($entity) { |
|
142 | 142 | return $entity->getLocale() |
143 | 143 | ? $entity->getLocale().' ('.$entity->getSlug().')' |
144 | 144 | : $entity->getSlug(); // switch for getLocale |
@@ -22,7 +22,9 @@ discard block |
||
22 | 22 | public function getH1($elseTitle = false): ?string |
23 | 23 | { |
24 | 24 | if ($elseTitle) { |
25 | - return ShortCodeConverter::do($this->h1 ?? $this->title ?? '', $this->getLocale()); |
|
25 | + return ShortCodeConverter::do { |
|
26 | + ($this->h1 ?? $this->title ?? '', $this->getLocale()); |
|
27 | + } |
|
26 | 28 | } |
27 | 29 | |
28 | 30 | return $this->h1; |
@@ -64,7 +66,9 @@ discard block |
||
64 | 66 | |
65 | 67 | public function getSlug(): ?string |
66 | 68 | { |
67 | - if (!$this->slug) return $this->id; |
|
69 | + if (!$this->slug) { |
|
70 | + return $this->id; |
|
71 | + } |
|
68 | 72 | |
69 | 73 | return $this->slug; |
70 | 74 | } |