diff --git a/includes/forms/_garbagecode.php b/includes/forms/_garbagecode.php new file mode 100644 index 0000000..d5c270a --- /dev/null +++ b/includes/forms/_garbagecode.php @@ -0,0 +1,47 @@ + $document) : ?> + + + +
+
+ + + +

+ + +

+
+ + +
+
+ + +
+
+ + +
+ +
+ + +

+ + + +
+ + +
+ + +
+ \ No newline at end of file diff --git a/includes/forms/field-OrderDocumentsList.php b/includes/forms/field-OrderDocumentsList.php index 1c5d55a..86d3d67 100644 --- a/includes/forms/field-OrderDocumentsList.php +++ b/includes/forms/field-OrderDocumentsList.php @@ -5,46 +5,30 @@ if (class_exists('GF_Field')) { { public $type = 'order_documents_list'; - public $choices = [ - ['text' => 'Synthèse des primes'], - ['text' => 'Publication 2'], - ['text' => 'Publication 3'], - ]; - - // public $choices = [ - // [ - // 'text' => 'Synthèse des primes', - // 'slug' => "the post name", - // 'ID' => 24 - // ], - // [ - // 'text' => 'Document 2', - // 'slug' => "the post name", - // 'ID' => 24 - // ], - - // ]; - - private function buildChoices() + private function buildChoicesArray() { - $choices = [ + $posts_array = [ [ 'text' => 'La synthèse des primes', - 'description' => __("Ce document informe sur les incitants financiers à l’achat et à la rénovation des logements en Région de Bruxelles-Capitale, dont les primes RENOLUTION, le crédit ECORENO, la subvention petit patrimoine, la prime gaz, les certificats verts...", "homegrade-theme__texte-fonctionnel"), - 'slug' => "the post name", - 'ID' => 24 + 'ID_fr' => 7153, + 'ID_nl' => 7157, ], - [ - 'text' => 'Document 2', - 'slug' => "the post name", - 'ID' => 24 - ], - ]; + $currentLang = apply_filters('wpml_current_language', null); - $this->choices = $choices; + + foreach ($posts_array as $post) { + $id = $currentLang === 'nl' ? $post['ID_nl'] : $post['ID_fr']; + + $choices[] = [ + 'title' => get_the_title($id), + 'ID' => $id, + ]; + } + + return $choices; } public function get_form_editor_field_title() @@ -125,31 +109,31 @@ if (class_exists('GF_Field')) { } - private function PrettyListBrochureOrder($value) + private function PrettyListDocumentOrder($value) { - $brochureOrderPreviewHtml = ''; + return $documentOrderPreviewHtml; } @@ -164,14 +148,14 @@ if (class_exists('GF_Field')) { if (empty($value)) { return; } - $str = $this->PrettyListBrochureOrder($value); + $str = $this->PrettyListDocumentOrder($value); return $str; } public function get_value_merge_tag($value, $input_id, $entry, $form, $modifier, $raw_value, $url_encode, $esc_html, $format, $nl2br) { - return $this->PrettyListBrochureOrder($value); + return $this->PrettyListDocumentOrder($value); } } GF_Fields::register(new OrderDocumentList()); diff --git a/includes/forms/template-field-order-brochures.php b/includes/forms/template-field-order-brochures.php index c344826..bb0e741 100644 --- a/includes/forms/template-field-order-brochures.php +++ b/includes/forms/template-field-order-brochures.php @@ -10,6 +10,7 @@ term_id); + $brochure_pdf_link = get_field('brochure_pdf', $brochurePost['ID']); ?> @@ -22,7 +23,9 @@ name ?>

- + + +
diff --git a/includes/forms/template-field-order-documents.php b/includes/forms/template-field-order-documents.php index 4aa02b0..9677ffe 100644 --- a/includes/forms/template-field-order-documents.php +++ b/includes/forms/template-field-order-documents.php @@ -4,15 +4,16 @@
buildChoices(); + $otherPublicationsArray = $this->buildChoicesArray(); ?> - choices as $index => $document) : ?> + + $document) : ?>
@@ -25,7 +26,7 @@

- + post_title ?>
@@ -39,8 +40,8 @@
- -

+ post_content) : ?> + diff --git a/resources/css/components/forms.css b/resources/css/components/forms.css index 4a01ac3..e8c691d 100644 --- a/resources/css/components/forms.css +++ b/resources/css/components/forms.css @@ -89,6 +89,10 @@ form:not(.metabox-location-side):not(.metabox-location-normal):not( } } +legend.gfield_label + .gfield_description { + @apply !pb-4; +} + .gform_wrapper { .gform_title { @apply hidden; @@ -182,17 +186,21 @@ form:not(.metabox-location-side):not(.metabox-location-normal):not( } */ .field-order-paper-publications { - @apply !grid gap-x-12 gap-y-2; + @apply !grid gap-x-12 gap-y-6 md:gap-y-2; .brochure-order-field { - @apply grid justify-end gap-3 items-center; - grid-template-columns: auto 1fr 1fr auto; + @apply grid justify-end gap-3 gap-y-2 items-center; + grid-template-columns: 1fr; + @screen md { + grid-template-columns: auto 1fr 1fr auto; + } + .thematique-tag, legend { - @apply mt-6; + @apply md:mt-6; } .thematique-tag { - @apply !py-1 !px-4 !rounded-lg mr-4 flex items-center shrink-0; + @apply !py-1 !px-4 !rounded-lg mr-4 flex items-center shrink-0 w-fit; line-height: 1.7; } .thematique-icon { @@ -203,7 +211,8 @@ form:not(.metabox-location-side):not(.metabox-location-normal):not( font-weight: revert !important; } .preview-brochure { - @apply !text-neutral-700 flex justify-center items-center w-fit mx-auto; + @apply !text-neutral-700 flex justify-center items-center w-fit md:mx-auto; + &:after { content: ' '; @apply w-4 h-4 block ml-3 bg-no-repeat bg-center bg-contain; @@ -233,6 +242,9 @@ form:not(.metabox-location-side):not(.metabox-location-normal):not( } } } +.homegrade-delivering .gfield_description { + @apply !text-secondary py-2; +} #gform_wrapper_18 { @apply max-w-screen-lg;