
<?php
/**
 * The component for displaying the footer standard layout
 *
 * @global $options
 * @global $footer_background
 * @global $footer_text
 *
 * @package Reach
 */

 use Reach\App\Theme\ThemeStyles;
 use Reach\App\Attachments\Media;


 // get our color settings for this element
 $background_color_primary       = ! empty( $options['footer_color'] ) ? $options['footer_color'] : '#000000';
 $background_color_secondary     = ! empty( $options['footer_color_secondary'] ) ? $options['footer_color_secondary'] : '#000000';
 $background_color_tertiary      = ! empty( $options['footer_color_tertiary'] ) ? $options['footer_color_tertiary'] : '#000000';

 $color_contrast                 = ThemeStyles::colorLightOrDark( $background_color_primary, 'dark', 'light' );
 $footer_widget_text_alignment   = ! empty( $options['footer_widget_text_align'] ) ? 'content-' . $options['footer_widget_text_align'] : 'content-left';
 $footer_widget_text_color       = ! empty( $options['footer_widget_text_color'] ) ? $options['footer_widget_text_color'] : '#ffffff';
 $logo                           = ! empty( $options['footer_logo'] ) ? Media::getAttachmentByID( $options['footer_logo'] ) : false;
 $logo_url                       = ! empty( $logo->url ) ?  $logo->url : AD_THEME_DIR_URI . 'assets/images/rl-logo.png';
 $logo_alt                       = ! empty( $logo->alt ) ?  $logo->alt : __( 'Powered by ReachLocal Logo', 'reach' );

?>

<div class="footer-layout footer-layout-minimal">
  <footer class="footer  <?php echo 'text--' . $color_contrast; ?>" role="contentinfo" style="background: <?php echo $background_color_primary; ?>">

    <div class="footer__top" style="background: <?php echo $background_color_primary; ?>">
      <div class="container">
         <div class="row">
         <div class="col-xs-12 col-sm-6">
           <?php
           // Loads the menu/footer.php template.
           get_template_part( 'menu/footer' );

           // Loads the menu/footer-utility.php template.
           get_template_part( 'menu/footer', 'utility' );
           ?>
         </div>
         <div class="col-xs-12 col-sm-6">
          <?php
           // Loads the components/footer-socials.php template.
           get_template_part( 'components/footer', 'socials' );
           ?>
         </div>
        </div>
      </div>
    </div>

  <div class="footer__bottom" style="background: <?php echo $background_color_tertiary; ?>">
   <div class="container">
     <div class="row align-items-center">
       <div class="footer__copyright col-xs-12 col-sm-6">
         <div class="footer__copyright--text">
           <?php
           printf(
               '&copy %1$s %2$s. ' . __( 'All Rights Reserved.', 'reach' ),
               date( 'Y' ),
               get_bloginfo( 'name' )
           );
           ?>
         </div>

           <?php
           // Loads the menu/footer-auxiliary.php template.
           get_template_part( 'menu/footer', 'auxiliary' );
           ?>

       </div>

       <div class="footer__logo col-xs-12 col-sm-6">
         <?php

         if( empty( $options['hide_footer_logo'] ) ) {
           echo '<div class="footer__logo"><img src="' . esc_url( $logo_url ) . '" alt="' . $logo_alt . '"></div>';
         }

         ?>
       </div>
       </div>

     </div>
   </div>
 </footer>
</div>
