diff --git a/app/Http/Requests/UpdateMiniAcfRequest.php b/app/Http/Requests/UpdateMiniAcfRequest.php index cd8d1723..d867bbd8 100644 --- a/app/Http/Requests/UpdateMiniAcfRequest.php +++ b/app/Http/Requests/UpdateMiniAcfRequest.php @@ -216,7 +216,7 @@ class UpdateMiniAcfRequest extends FormRequest private function handleText(string $inputKey): array { - return ["$inputKey.value" => 'required|string|min:15']; + return ["$inputKey.html" => 'required|string|min:15']; } private function handleString(string $inputKey): array diff --git a/app/Models/NutritionPage.php b/app/Models/NutritionPage.php index d927dd7a..bfb03110 100644 --- a/app/Models/NutritionPage.php +++ b/app/Models/NutritionPage.php @@ -54,7 +54,7 @@ class NutritionPage extends Model 'content' => [ 'label' => 'Contenu', 'inputType' => InputType::text(), - 'value' => '' + 'html' => '' ], 'side' => [ 'label' => 'Orientation de l\'image (gauche ou droite)', @@ -86,7 +86,7 @@ class NutritionPage extends Model 'content' => [ 'label' => 'Contenu', 'inputType' => InputType::text(), - 'value' => '' + 'html' => '' ], 'labels' => [ 'label' => 'Labels avec titre', @@ -113,7 +113,7 @@ class NutritionPage extends Model 'content' => [ 'label' => 'Contenu', 'inputType' => InputType::text(), - 'value' => '' + 'html' => '' ], 'link' => [ 'label' => 'Lien en bas du bloc', @@ -148,7 +148,7 @@ class NutritionPage extends Model 'content' => [ 'label' => 'Contenu', 'inputType' => InputType::text(), - 'value' => '' + 'html' => '' ], 'dropdownArray' => [ 'label' => 'Dropdowns', @@ -170,7 +170,7 @@ class NutritionPage extends Model 'content' => [ 'label' => 'Contenu', 'inputType' => InputType::text(), - 'value' => '' + 'html' => '' ] ] ], diff --git a/app/Traits/MiniAcfModel.php b/app/Traits/MiniAcfModel.php index d85f4330..f186631c 100644 --- a/app/Traits/MiniAcfModel.php +++ b/app/Traits/MiniAcfModel.php @@ -62,7 +62,7 @@ trait MiniAcfModel { return [ 'title' => '', - 'content' => '' + 'html' => '' ]; } diff --git a/database/migrations/2021_09_25_094347_create_nutrition_pages_table.php b/database/migrations/2021_09_25_094347_create_nutrition_pages_table.php index e0071f20..01adcb2a 100644 --- a/database/migrations/2021_09_25_094347_create_nutrition_pages_table.php +++ b/database/migrations/2021_09_25_094347_create_nutrition_pages_table.php @@ -60,7 +60,7 @@ class CreateNutritionPagesTable extends Migration 'value' => $faker->sentence(7) ], 'content' => [ - 'value' => $faker->text(620) + 'html' => $faker->text(620) ], 'side' => [ // image à gauche @@ -73,7 +73,7 @@ class CreateNutritionPagesTable extends Migration for ($i = 0; $i < $max; $i++) { $out[] = [ 'title' => $faker->sentence(8), - 'content' => + 'html' => // phpcs:ignore Generic.Files.LineLength.TooLong 'En savoir + sur chenilles à pattes de poulets ' . $faker->text(620) @@ -101,7 +101,7 @@ class CreateNutritionPagesTable extends Migration 'value' => $faker->sentence(9) ], 'content' => [ - 'value' => $faker->text(600) + 'html' => $faker->text(600) ], 'side' => [ // image à droite @@ -114,7 +114,7 @@ class CreateNutritionPagesTable extends Migration for ($i = 0; $i < $max; $i++) { $out[] = [ 'title' => $faker->sentence(8), - 'content' => + 'html' => // phpcs:ignore Generic.Files.LineLength.TooLong 'En savoir + sur chenilles à pattes de poulets ' . $faker->text(620) @@ -142,7 +142,7 @@ class CreateNutritionPagesTable extends Migration 'value' => $faker->sentence(9) ], 'content' => [ - 'value' => $faker->text(600) + 'html' => $faker->text(600) ], 'link' => [ 'status' => false, @@ -173,7 +173,7 @@ class CreateNutritionPagesTable extends Migration 'value' => $faker->sentence(9) ], 'content' => [ - 'value' => $faker->text(750) + 'html' => $faker->text(750) ], 'dropdownArray' => [ 'value' => (function () use ($faker) { @@ -182,7 +182,7 @@ class CreateNutritionPagesTable extends Migration for ($i = 0; $i < $max; $i++) { $out[] = [ 'title' => $faker->sentence(8), - 'content' => + 'html' => // phpcs:ignore Generic.Files.LineLength.TooLong 'En savoir + sur chenilles à pattes de poulets ' . $faker->text(620) @@ -223,7 +223,7 @@ class CreateNutritionPagesTable extends Migration 'value' => $faker->sentence(7) ], 'content' => [ - 'value' => $faker->text(620) + 'html' => $faker->text(620) ], 'side' => [ // image à droite @@ -236,7 +236,7 @@ class CreateNutritionPagesTable extends Migration for ($i = 0; $i < $max; $i++) { $out[] = [ 'title' => $faker->sentence(8), - 'content' => + 'html' => // phpcs:ignore Generic.Files.LineLength.TooLong 'En savoir + sur chenilles à pattes de poulets ' . $faker->text(620) @@ -264,7 +264,7 @@ class CreateNutritionPagesTable extends Migration 'value' => $faker->sentence(7) ], 'content' => [ - 'value' => $faker->text(620) + 'html' => $faker->text(620) ], 'labels' => [ 'value' => (function () use ($faker) { @@ -298,7 +298,7 @@ class CreateNutritionPagesTable extends Migration 'value' => $faker->sentence(9) ], 'content' => [ - 'value' => $faker->text(600) + 'html' => $faker->text(600) ], 'link' => [ 'status' => true, @@ -325,7 +325,7 @@ class CreateNutritionPagesTable extends Migration )) ], 'content' => [ - 'value' => $faker->text(600) + 'html' => $faker->text(600) ] ] ] diff --git a/resources/views/bo/modules/mini-acf/dropdown-input.blade.php b/resources/views/bo/modules/mini-acf/dropdown-input.blade.php index 93ebe33f..2ed5b0d4 100644 --- a/resources/views/bo/modules/mini-acf/dropdown-input.blade.php +++ b/resources/views/bo/modules/mini-acf/dropdown-input.blade.php @@ -9,12 +9,12 @@ $o = $o ?? 'X';
- + + name="content[{{$i}}][content][{{$k}}][value][{{ ($tmpl ? 'X' : $o) }}][html]" + dbtext="{{ old("content.$i.content.$k.value.$o.html") ?? (!$tmpl ? ($dropdown['html'] ?? '') : '') }}"> @@ -70,7 +70,7 @@ if(!__MINIACF.dropdown) { $(el).prev().attr('for', xfor.join('_')); } $(el).attr('name', $(el).attr('name') - .replace(/(?:\[(X|[0-9]*)\])\[(title|content)\]$/, '[' + (c-1) + '][$2]')); + .replace(/(?:\[(X|[0-9]*)\])\[(title|html)\]$/, '[' + (c-1) + '][$2]')); console.log(el) }); }; diff --git a/resources/views/bo/modules/mini-acf/form-inputs.blade.php b/resources/views/bo/modules/mini-acf/form-inputs.blade.php index 6177c52d..301cb9d8 100644 --- a/resources/views/bo/modules/mini-acf/form-inputs.blade.php +++ b/resources/views/bo/modules/mini-acf/form-inputs.blade.php @@ -19,8 +19,8 @@
+ name="content[{{$i}}][content][{{$k}}][html]" + dbtext="{{ old("content.$i.content.$k.html") ?? $input['html'] ?? '' }}">
@break @case(InputType::boolean()->value) @@ -128,8 +128,34 @@ @break + @case(InputType::miniblocArray()->value) +
+
+
{{ __('Minibloc') }}
+
+
+ @include('bo.modules.mini-acf.minibloc-input', [ + 'i' => $i, + 'k' => $k, + 'tmpl' => true, + ]) + @foreach($input['value'] as $o => $minibloc) + @include('bo.modules.mini-acf.minibloc-input', [ + 'i' => $i, + 'k' => $k, + 'o' => $o, + 'tmpl' => false, + 'minibloc' => $minibloc, + ]) + @endforeach +
+ +
+
+
+ @break @default - @dump('unknown input type') + @dump('unknown input type',$input['inputType']) @endswitch @endforeach diff --git a/resources/views/front/nutrition-page/blocs/bloc1.blade.php b/resources/views/front/nutrition-page/blocs/bloc1.blade.php index 2db26eff..e8fad321 100644 --- a/resources/views/front/nutrition-page/blocs/bloc1.blade.php +++ b/resources/views/front/nutrition-page/blocs/bloc1.blade.php @@ -3,7 +3,7 @@

{!! clean($bloc['content']['title']['value']) !!}

- {!! clean($bloc['content']['content']['value']) !!} + {!! clean($bloc['content']['content']['html']) !!}
@if(count($bloc['content']['dropdownArray']['value']))