]> _ Git - usines-reunies.git/commitdiff
WIP #4064 @7
authorStephen Cameron <stephen@cubedesigners.com>
Tue, 8 Dec 2020 17:55:26 +0000 (18:55 +0100)
committerStephen Cameron <stephen@cubedesigners.com>
Tue, 8 Dec 2020 17:55:26 +0000 (18:55 +0100)
web/app/mu-plugins/cube/src/Customizer/Setup.php
web/app/themes/Usines/resources/assets/styles/components/footer.styl
web/app/themes/Usines/resources/views/partials/footer.blade.php

index 9a91682af9d42e590362e6af3af2635c0104600b..fa23886edc73231237b2252a9bb837224499c733 100644 (file)
@@ -4,6 +4,7 @@ namespace Cube\Customizer;
 
 use WP_Customize_Manager;
 use WP_Customize_Control;
+use WP_Customize_Image_Control;
 
 class Setup {
 
@@ -22,79 +23,135 @@ class Setup {
          * @return void
          */
         add_action('customize_register', function (WP_Customize_Manager $wp_customize) {
+            $this->site_details($wp_customize);
+            $this->footer_icons($wp_customize);
+        });
 
-            // Rename "Site Identity" section
-            $wp_customize->get_section('title_tagline')->title = __('Site Details', 'usines');
-            // Remove tagline control
-            $wp_customize->remove_control('blogdescription');
+    }
 
-            //-- Contact e-mail address (used in footer)
-            $wp_customize->add_setting(
-                'contact_email',
-                [
-                    'type' => 'option',
-                    'capability' => 'edit_theme_options'
-                ]
-            );
+    public function site_details(WP_Customize_Manager $wp_customize) {
+
+        // Rename "Site Identity" section
+        $wp_customize->get_section('title_tagline')->title = __('Site Details', 'usines');
+        // Remove tagline control
+        $wp_customize->remove_control('blogdescription');
+
+        //-- Contact e-mail address (used in footer)
+        $wp_customize->add_setting(
+            'contact_email',
+            [
+                'type' => 'option',
+                'capability' => 'edit_theme_options'
+            ]
+        );
+
+        $wp_customize->add_control(new WP_Customize_Control(
+            $wp_customize,
+            'contact_email',
+            [
+                'label'      => __('Adresse email', 'usines'),
+                'settings'   => 'contact_email',
+                'section'    => 'title_tagline',
+                'type'       => 'text',
+                'priority'   => 11,
+            ]
+        ));
+
+        //-- Contact phone number (used in header and footer)
+        $wp_customize->add_setting(
+            'contact_phone',
+            [
+                'type' => 'option',
+                'capability' => 'edit_theme_options'
+            ]
+        );
+
+        $wp_customize->add_control(new WP_Customize_Control(
+            $wp_customize,
+            'contact_phone',
+            [
+                'label'      => __('Numéro de téléphone', 'usines'),
+                'description' => __("Utilisé dans l'en-tête et le pied de page", 'usines'),
+                'settings'   => 'contact_phone',
+                'section'    => 'title_tagline',
+                'type'       => 'text',
+                'priority'   => 11,
+            ]
+        ));
+
+        //-- Header contact text
+        $wp_customize->add_setting(
+            'contact_header_text',
+            [
+                'type' => 'option',
+                'capability' => 'edit_theme_options'
+            ]
+        );
+
+        $wp_customize->add_control(new WP_Customize_Control(
+            $wp_customize,
+            'contact_header_text',
+            [
+                'label'      => __("Texte de contact d'en-tête", 'usines'),
+                'settings'   => 'contact_header_text',
+                'section'    => 'title_tagline',
+                'type'       => 'text',
+                'priority'   => 12,
+            ]
+        ));
+
+        //-- Footer contact text
+        $wp_customize->add_setting(
+            'contact_footer_text',
+            [
+                'type' => 'option',
+                'capability' => 'edit_theme_options'
+            ]
+        );
+
+        $wp_customize->add_control(new WP_Customize_Control(
+            $wp_customize,
+            'contact_footer_text',
+            [
+                'label'      => __('Texte de contact de pied de page', 'usines'),
+                'settings'   => 'contact_footer_text',
+                'section'    => 'title_tagline',
+                'type'       => 'textarea',
+                'priority'   => 13,
+            ]
+        ));
 
-            $wp_customize->add_control(new WP_Customize_Control(
-                $wp_customize,
-                'contact_email',
-                [
-                    'label'      => __('Adresse email', 'usines'),
-                    'settings'   => 'contact_email',
-                    'section'    => 'title_tagline',
-                    'type'       => 'text',
-                    'priority'   => 11,
-                ]
-            ));
+    }
 
-            //-- Contact phone number (used in header and footer)
-            $wp_customize->add_setting(
-                'contact_phone',
-                [
-                    'type' => 'option',
-                    'capability' => 'edit_theme_options'
-                ]
-            );
+    public function footer_icons(WP_Customize_Manager $wp_customize) {
 
-            $wp_customize->add_control(new WP_Customize_Control(
-                $wp_customize,
-                'contact_phone',
-                [
-                    'label'      => __('Numéro de téléphone', 'usines'),
-                    'description' => __("Utilisé dans l'en-tête et le pied de page", 'usines'),
-                    'settings'   => 'contact_phone',
-                    'section'    => 'title_tagline',
-                    'type'       => 'text',
-                    'priority'   => 11,
-                ]
-            ));
+        $icon_count = 4; // How many icons should there be?
 
-            //-- Header contact text
+        // Rename "Site Identity" section
+        $wp_customize->add_section('footer_icons')->title = __('Footer Icons', 'usines');
+
+        for ($i = 1; $i <= $icon_count; $i++) {
             $wp_customize->add_setting(
-                'contact_header_text',
+                "footer_icon_$i",
                 [
                     'type' => 'option',
                     'capability' => 'edit_theme_options'
                 ]
             );
 
-            $wp_customize->add_control(new WP_Customize_Control(
+            $wp_customize->add_control(new WP_Customize_Image_Control(
                 $wp_customize,
-                'contact_header_text',
+                "footer_icon_$i",
                 [
-                    'label'      => __("Texte de contact d'en-tête", 'usines'),
-                    'settings'   => 'contact_header_text',
-                    'section'    => 'title_tagline',
-                    'type'       => 'text',
-                    'priority'   => 12,
+                    'label'      => sprintf(__('Icône %d', 'usines'), $i),
+                    'settings'   => "footer_icon_$i",
+                    'section'    => 'footer_icons',
+                    'priority'   => 10 * $i,
                 ]
             ));
 
-            //-- Footer contact text
             $wp_customize->add_setting(
-                'contact_footer_text',
+                "footer_icon_text_$i",
                 [
                     'type' => 'option',
                     'capability' => 'edit_theme_options'
@@ -103,18 +160,16 @@ class Setup {
 
             $wp_customize->add_control(new WP_Customize_Control(
                 $wp_customize,
-                'contact_footer_text',
+                "footer_icon_text_$i",
                 [
-                    'label'      => __('Texte de contact de pied de page', 'usines'),
-                    'settings'   => 'contact_footer_text',
-                    'section'    => 'title_tagline',
+                    'label'      => sprintf(__('Description', 'usines'), $i),
+                    'settings'   => "footer_icon_text_$i",
+                    'section'    => 'footer_icons',
                     'type'       => 'textarea',
-                    'priority'   => 13,
+                    'priority'   => 10 * $i + 1,
                 ]
             ));
-
-
-        });
+        }
 
     }
 
index 63d7c93769cab4e91605254666d8dc0c8ab5d471..3825d000c8f96ac3fe2bb49d8255ee86b0036200 100644 (file)
@@ -21,18 +21,7 @@ $breakpoint-footer-1-col = 650px
   &-col-2, &-col-3, &-col-4
     margin-top: 5.25rem
 
-  &-col-2
     +below($breakpoint-footer-2-cols)
-      order: 4
-      margin-top: 3rem
-  &-col-3
-    +below($breakpoint-footer-2-cols)
-      order: 2
-    +below($breakpoint-footer-1-col)
-      margin-top: 3rem
-  &-col-4
-    +below($breakpoint-footer-2-cols)
-      order: 3
       margin-top: 3rem
 
   &-logo
index 8fea83b38766e5a9ac58dc3ad751b67e42f7a388..9226bb15c0a416f99284b80c5dec7619b5420807 100644 (file)
@@ -1,4 +1,18 @@
-<footer class="bg-blue-dark text-sm text-white pt-16 pb-8 px-1v mt-2v">
+{{-- Footer icons (managed in WordPress Customizer --}}
+<div class="flex sm:flex-wrap w-full py-2v mx-auto" style="max-width: 1600px">
+  @for ($i = 1; $i <= 4; $i++)
+    <div class="flex-grow-1 px-6 w-1/4 sm:w-1/2 sm:mb-6 sm:px-4">
+      @if ($icon = get_option("footer_icon_$i"))
+        <img src="{{ $icon }}" class="block mx-auto mb-4" style="max-width: 140px">
+        <p class="text-center sm:text-sm font-medium mx-auto" style="max-width: 13em">
+          {!! nl2br(get_option("footer_icon_text_$i")) !!}
+        </p>
+      @endif
+    </div>
+  @endfor
+</div>
+
+<footer class="bg-blue-dark text-sm text-white pt-16 pb-8 px-1v">
 
   {{-- Footer Columns --}}
   <div class="footer-container text-center">