2020 */
2121class MT_howto extends Widget_Base {
2222
23+ private $ _schema_rendered = false ;
24+
2325 public function __construct ( $ data = array (), $ args = null ) {
2426 parent ::__construct ( $ data , $ args );
2527
@@ -649,28 +651,28 @@ protected function register_controls() {
649651 'label ' => __ ( 'Position ' , 'mighty ' ),
650652 'type ' => Controls_Manager::CHOOSE ,
651653 'options ' => [
652- 'top ' => [
654+ 'column-reverse ' => [
653655 'title ' => __ ( 'Top ' , 'mighty ' ),
654656 'icon ' => 'eicon-v-align-top ' ,
655657 ],
656- 'bottom ' => [
658+ 'column ' => [
657659 'title ' => __ ( 'Bottom ' , 'mighty ' ),
658660 'icon ' => 'eicon-v-align-bottom ' ,
659661 ],
660- 'left ' => [
662+ 'row-reverse ' => [
661663 'title ' => __ ( 'Left ' , 'mighty ' ),
662664 'icon ' => 'eicon-h-align-left ' ,
663665 ],
664- 'right ' => [
666+ 'row ' => [
665667 'title ' => __ ( 'Right ' , 'mighty ' ),
666668 'icon ' => 'eicon-h-align-right ' ,
667669 ],
668670 ],
671+ 'default ' => 'right ' ,
672+ 'toggle ' => true ,
669673 'condition ' => [
670674 'image_position ' => 'custom '
671675 ],
672- 'default ' => 'right ' ,
673- 'toggle ' => true ,
674676 ]
675677 );
676678
@@ -695,7 +697,7 @@ protected function register_controls() {
695697 ],
696698 'condition ' => [
697699 'image_position ' => 'custom ' ,
698- 'image_alignment ' => [ 'top ' , 'bottom ' ],
700+ 'image_alignment ' => [ 'column-reverse ' , 'column ' ],
699701 ],
700702 'default ' => 'center ' ,
701703 'toggle ' => true ,
@@ -723,7 +725,7 @@ protected function register_controls() {
723725 ],
724726 'condition ' => [
725727 'image_position ' => 'custom ' ,
726- 'image_alignment ' => [ 'left ' , 'right ' ],
728+ 'image_alignment ' => [ 'row-reverse ' , 'row ' ],
727729 ],
728730 'default ' => 'middle ' ,
729731 'toggle ' => true ,
@@ -1845,7 +1847,7 @@ protected function register_controls() {
18451847 ]
18461848 ],
18471849 'selectors ' => [
1848- '{{WRAPPER}} .mt-how-to-step-section-title ' => 'margin-bottom: {{SIZE}}{{UNIT}} ' ,
1850+ '{{WRAPPER}} .mt-how-to-step ' => 'margin-bottom: {{SIZE}}{{UNIT}} ' ,
18491851 ],
18501852 ]
18511853 );
@@ -2193,25 +2195,28 @@ protected function register_controls() {
21932195 'label ' => __ ( 'Position ' , 'mighty ' ),
21942196 'type ' => Controls_Manager::CHOOSE ,
21952197 'options ' => [
2196- 'top ' => [
2198+ 'column-reverse ' => [
21972199 'title ' => __ ( 'Top ' , 'mighty ' ),
21982200 'icon ' => 'eicon-v-align-top ' ,
21992201 ],
2200- 'bottom ' => [
2202+ 'column ' => [
22012203 'title ' => __ ( 'Bottom ' , 'mighty ' ),
22022204 'icon ' => 'eicon-v-align-bottom ' ,
22032205 ],
2204- 'left ' => [
2206+ 'row-reverse ' => [
22052207 'title ' => __ ( 'Left ' , 'mighty ' ),
22062208 'icon ' => 'eicon-h-align-left ' ,
22072209 ],
2208- 'right ' => [
2210+ 'row ' => [
22092211 'title ' => __ ( 'Right ' , 'mighty ' ),
22102212 'icon ' => 'eicon-h-align-right ' ,
22112213 ],
22122214 ],
22132215 'default ' => 'right ' ,
22142216 'toggle ' => true ,
2217+ 'selectors ' => [
2218+ '{{WRAPPER}} .mt-how-to-step.mt-has-img ' => 'flex-direction: {{VALUE}}; ' ,
2219+ ],
22152220 ]
22162221 );
22172222
@@ -2235,7 +2240,7 @@ protected function register_controls() {
22352240 ],
22362241 ],
22372242 'condition ' => [
2238- 'step_image_alignment ' => [ 'top ' , 'bottom ' ]
2243+ 'step_image_alignment ' => [ 'column-reverse ' , 'column ' ]
22392244 ],
22402245 'default ' => 'center ' ,
22412246 'toggle ' => true ,
@@ -2265,7 +2270,7 @@ protected function register_controls() {
22652270 ],
22662271 ],
22672272 'condition ' => [
2268- 'step_image_alignment ' => [ 'left ' , 'right ' ]
2273+ 'step_image_alignment ' => [ 'row-reverse ' , 'row ' ]
22692274 ],
22702275 'default ' => 'center ' ,
22712276 'toggle ' => true ,
@@ -2326,10 +2331,10 @@ protected function register_controls() {
23262331 ]
23272332 ],
23282333 'selectors ' => [
2329- '{{WRAPPER}} .mt-step-img-top .mt- how-to-step-image ' => 'margin-bottom: {{SIZE}}{{UNIT}} ' ,
2330- '{{WRAPPER}} .mt-step-img-right .mt- how-to-step-image ' => 'margin-left: {{SIZE}}{{UNIT}} ' ,
2331- '{{WRAPPER}} .mt-step-img-bottom .mt- how-to-step-image ' => 'margin-top: {{SIZE}}{{UNIT}} ' ,
2332- '{{WRAPPER}} .mt-step-img-left .mt- how-to-step-image ' => 'margin-right: {{SIZE}}{{UNIT}} ' ,
2334+ '{{WRAPPER}} .mt-how-to-step-column-reverse ' => 'margin-bottom: {{SIZE}}{{UNIT}} ' ,
2335+ '{{WRAPPER}} .mt-how-to-step-row ' => 'margin-left: {{SIZE}}{{UNIT}} ' ,
2336+ '{{WRAPPER}} .mt-how-to-step-column ' => 'margin-top: {{SIZE}}{{UNIT}} ' ,
2337+ '{{WRAPPER}} .mt-how-to-step-row-reverse ' => 'margin-right: {{SIZE}}{{UNIT}} ' ,
23332338 ],
23342339 ]
23352340 );
@@ -2344,9 +2349,9 @@ protected function get_how_to_json_ld() {
23442349 $ how_to_title = $ settings ['how_to_title ' ];
23452350 $ how_to_description = wp_json_encode ( $ settings ['how_to_description ' ] );
23462351 $ how_to_image = $ settings ['how_to_image ' ];
2347- $ show_advanced = $ settings ['show_advanced ' ];
2352+ $ show_advanced = $ settings ['how_to_advance_option ' ];
23482353 $ years = ( '' !== $ settings ['duration_year ' ] ) ? $ settings ['duration_year ' ] : '0 ' ;
2349- $ months = ( '' !== $ settings ['duration_month ' ] ) ? $ settings ['total_time_months ' ] : '0 ' ;
2354+ $ months = ( '' !== $ settings ['duration_month ' ] ) ? $ settings ['duration_month ' ] : '0 ' ;
23502355 $ days = ( '' !== $ settings ['duration_days ' ] ) ? $ settings ['duration_days ' ] : '0 ' ;
23512356 $ hours = ( '' !== $ settings ['duration_hours ' ] ) ? $ settings ['duration_hours ' ] : '0 ' ;
23522357 $ minutes = ( '' !== $ settings ['duration_minutes ' ] ) ? $ settings ['duration_minutes ' ] : '0 ' ;
@@ -2358,7 +2363,7 @@ protected function get_how_to_json_ld() {
23582363 $ supplies = $ settings ['supply_list ' ];
23592364 $ add_tools = $ settings ['how_to_tool ' ];
23602365 $ tools = $ settings ['tool_list ' ];
2361- $ step_section_title = $ settings ['mt-how-to-step-section-title ' ];
2366+ $ step_section_title = $ settings ['steps_title ' ];
23622367 $ steps_form = $ settings ['step_list ' ];
23632368 $ enable_schema = true ;
23642369
@@ -2498,6 +2503,8 @@ protected function render()
24982503 $ minutes = ( $ settings ['duration_minutes ' ] > 1 ) ? ' minutes, ' : ' minute, ' ;
24992504 $ total_time = $ total_time . ' ' . $ settings ['duration_minutes ' ] . $ minutes ;
25002505 }
2506+
2507+ $ total_time = rtrim ($ total_time , ", " );
25012508 }
25022509
25032510 if ( $ settings ['how_to_estimated_time ' ] == 'yes ' ) {
@@ -2510,13 +2517,16 @@ protected function render()
25102517 $ estimate_time = $ estimate_time . $ settings ['estimate_cost ' ] . '</span> ' ;
25112518 }
25122519 }
2513-
2520+
25142521 $ this ->add_render_attribute ( 'mt-how-to-title ' , 'class ' , 'mt-how-to-title ' );
25152522 $ this ->add_render_attribute ( 'mt-how-to-supply-title ' , 'class ' , 'mt-how-to-supply-title ' );
25162523 $ this ->add_render_attribute ( 'mt-how-to-tools-title ' , 'class ' , 'mt-how-to-tools-title ' );
25172524 $ this ->add_render_attribute ( 'mt-how-to-step-title ' , 'class ' , 'mt-how-to-step-title ' );
25182525 $ this ->add_render_attribute ( 'mt-how-to-step-section-title ' , 'class ' , 'mt-how-to-step-section-title ' );
25192526 $ this ->add_render_attribute ( 'mt-how-to-step-content ' , 'style ' , 'width:calc(100% - ' . $ settings ['step_image_width ' ]['size ' ].'%); ' );
2527+ $ this ->add_render_attribute ( 'mt-how-to-step-content ' , 'class ' , 'mt-how-to-step-content ' );
2528+ $ this ->add_render_attribute ( 'mt-how-to-step ' , 'class ' , 'mt-how-to-step ' );
2529+ $ this ->add_render_attribute ( 'mt-how-to-step ' , 'class ' , 'mt-has-img ' );
25202530
25212531 ?>
25222532
@@ -2599,15 +2609,15 @@ protected function render()
25992609 <p class="mt-how-to-step-section-sub-title"><?php echo $ settings ['steps_description ' ];?> </p>
26002610
26012611 <?php foreach ( $ settings ['step_list ' ] as $ key => $ value ) { ?>
2602-
2612+
26032613 <?php if ( $ value ['image_position ' ] == 'custom ' ) { ?>
26042614
2605- <div class="mt-how-to-step mt-has-img mt-step-img-<?php echo $ value ['image_alignment ' ];?> " >
2615+ <div <?php echo $ this ->get_render_attribute_string ('mt-how-to-step ' ); ?> style="flex-direction:<?php echo $ value ['image_alignment ' ];?> ">
2616+
26062617 <?php } else { ?>
2607- <div class="mt-how-to-step mt-has-img mt-step-img- < ?php echo $ settings [ ' step_image_alignment ' ]; ?> " >
2618+ <div < ?php echo $ this -> get_render_attribute_string ( ' mt-how-to-step ' ); ?> >
26082619 <?php } ?>
2609-
2610- <div class="mt-how-to-step-content">
2620+ <div <?php echo $ this ->get_render_attribute_string ('mt-how-to-step-content ' ); ?> >
26112621 <?php if ( !empty ( $ value ['step_title ' ] ) ) { ?>
26122622 <?php if ( !empty ($ value ['step_image_link ' ]['url ' ] ) ) { ?>
26132623 <a target="_blank" href="<?php echo $ value ['step_image_link ' ]['url ' ];?> " >
@@ -2643,17 +2653,17 @@ protected function render()
26432653
26442654 <?php } ?>
26452655
2646- <?php if ( $ value ['image_position ' ] == 'custom ' && ( $ value ['image_alignment ' ] == 'top ' || $ value ['image_alignment ' ] == 'bottom ' ) ) { ?>
2656+ <?php if ( $ value ['image_position ' ] == 'custom ' && ( $ value ['image_alignment ' ] == 'column-reverse ' || $ value ['image_alignment ' ] == 'column ' ) ) { ?>
26472657
2648- <div class="mt-how-to-step-image" style="align-self:<?php echo $ value ['horizontal_alignment ' ];?> ">
2658+ <div class="mt-how-to-step-image mt-how-to-step- <?php echo $ value [ ' image_alignment ' ]; ?> " style="align-self:<?php echo $ value ['horizontal_alignment ' ];?> ">
26492659
2650- <?php } elseif ( $ value ['image_position ' ] == 'custom ' && ( $ value ['image_alignment ' ] == 'left ' || $ value ['image_alignment ' ] == 'right ' ) ) { ?>
2660+ <?php } elseif ( $ value ['image_position ' ] == 'custom ' && ( $ value ['image_alignment ' ] == 'row-reverse ' || $ value ['image_alignment ' ] == 'row ' ) ) { ?>
26512661
2652- <div class="mt-how-to-step-image" style="align-self:<?php echo $ value ['vertical_alignment ' ];?> ">
2662+ <div class="mt-how-to-step-image mt-how-to-step- <?php echo $ value [ ' image_alignment ' ]; ?> " style="align-self:<?php echo $ value ['vertical_alignment ' ];?> ">
26532663
26542664 <?php } else { ?>
26552665
2656- <div class="mt-how-to-step-image">
2666+ <div class="mt-how-to-step-image mt-how-to-step- <?php echo $ settings [ ' step_image_alignment ' ]; ?> ">
26572667
26582668 <?php } ?>
26592669 <?php if ( 'no ' !== $ settings ['step_enable_lightbox ' ] ) {
0 commit comments