]> _ Git - physioassist-wordpress.git/commitdiff
WIP #1912 @3
authorstephen@cubedesigners.com <stephen@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 15 May 2018 16:01:57 +0000 (16:01 +0000)
committerstephen@cubedesigners.com <stephen@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 15 May 2018 16:01:57 +0000 (16:01 +0000)
wp-content/mu-plugins/physioassist/src/Elementor/Setup.php
wp-content/mu-plugins/physioassist/src/Elementor/Widgets/ProfileGrid.php
wp-content/themes/physioassist/resources/assets/styles/common/utilities.styl
wp-content/themes/physioassist/resources/assets/styles/widgets/toggle.styl [new file with mode: 0644]

index 05b3f92c12f531223a29922cf5c98c39462c6ce3..ffd075f3b2077aa3334c08bd918b18fb8d29aaa1 100644 (file)
@@ -23,6 +23,7 @@ class Setup {
 
     public function register_customisations() {
 
+        //--- Heading Widget
         // Extend Elementor's heading widget to add a CSS class based on the alignment setting so we can also control the position of the underline
         add_action( 'elementor/element/heading/section_title/before_section_end', function( $element, $args ) {
             $elementor = Plugin::instance();
@@ -41,6 +42,26 @@ class Setup {
 
         // Todo: consider add a control to the existing heading widget that allows the underline to be disabled (via prefix_class?)
 
+
+        //--- Toggle Widget
+        // Override default icons
+        add_action( 'elementor/element/toggle/section_toggle/before_section_end', function( $element, $args ) {
+            $elementor = Plugin::instance();
+            $icon_control = $elementor->controls_manager->get_control_from_stack( $element->get_name(), 'icon' );
+            $icon_active_control = $elementor->controls_manager->get_control_from_stack( $element->get_name(), 'icon_active' );
+
+            if (is_wp_error($icon_control) || is_wp_error($icon_active_control)) {
+                return;
+            }
+
+            $icon_control['default'] = 'fa fa-chevron-right';
+            $element->update_control( 'icon', $icon_control );
+
+            $icon_active_control['default'] = 'fa fa-chevron-down';
+            $element->update_control( 'icon_active', $icon_active_control );
+        }, 10, 2);
+
+
     }
 
     public function register_widgets() {
index 189339f18b5a4f6de16ac4b20008c373ed682df8..9da66a650e6a0894f8ecb1c76b6b1da8d62118cc 100644 (file)
@@ -9,7 +9,7 @@ use Elementor\Utils;
 
 class ProfileGrid extends Widget_Base {
 
-    protected $_has_template_content = false; // Tell Elementor that content is all rendered dynamically
+    protected $_has_template_content = true;
 
     // Widget name / ID
     public function get_name() {
@@ -129,4 +129,52 @@ class ProfileGrid extends Widget_Base {
         echo '<div class="profile-grid">'. $html .'</div>';
     }
 
+    /**
+     * Render widget output in the editor.
+     *
+     * Written as a Backbone JavaScript template and used to generate the live preview.
+     *
+     * @since 1.0.0
+     * @access protected
+     */
+    protected function _content_template() {
+        ?>
+        <div class="profile-grid">
+            <#
+                if ( settings.items ) {
+
+                _.each( settings.items, function( item, index ) {
+                #>
+                <div class="profile-grid-item">
+
+                    <img src="{{ item.image.url }}" class="profile-grid-image">
+
+                    <div class="profile-grid-text">
+
+                        <h3 class="profile-grid-title">{{{ item.title }}}</h3>
+
+                        <# if ('' !== item.subtitle) { #>
+                            <h4 class="profile-grid-subtitle">{{{ item.subtitle }}}</h4>
+                        <# } #>
+
+                        <div class="profile-grid-body">
+                            {{{ item.body }}}
+                        </div>
+
+                        <# if ('' !== item.cta_text && '' !== item.cta_link.url) { #>
+                            <a href="{{ item.cta_link.url }}" class="profile-grid-cta">
+                                <?= \BladeSvgSage\svg_image('arrow')->toHtml() ?>
+                                {{ item.cta_text }}
+                            </a>
+                        <# } #>
+                    </div>
+
+                </div>
+                <#
+                    });
+                } #>
+        </div>
+        <?php
+    }
+
 }
index c83d28d406efa81e603e46fce0cfb88b0b5df9af..a5983e619fe920991d4125c00be3d70e29e72bca 100644 (file)
@@ -1,3 +1,6 @@
 .disable-vertical-spacing
   padding-top: 0 !important
   padding-bottom: 0 !important
+
+.indent-content
+  constrain(padding-left, 7.5vw)
diff --git a/wp-content/themes/physioassist/resources/assets/styles/widgets/toggle.styl b/wp-content/themes/physioassist/resources/assets/styles/widgets/toggle.styl
new file mode 100644 (file)
index 0000000..7efd09c
--- /dev/null
@@ -0,0 +1,20 @@
+.elementor-toggle
+
+  .elementor-toggle-item
+    margin-bottom: 1em
+
+  .elementor-toggle-icon
+    font-size: 0.8em
+    margin-top: 3px
+    margin-right: 0.9em
+
+  .elementor-tab-title
+    outline: none
+    color: $colors.headings
+    font-size: 26px
+    font-weight: 600
+    border-bottom: none
+
+  .elementor-tab-content
+    margin-left: 2.7em
+    border-bottom: none