<?php /* NOTE: GENERATED BY GULP !!! */ ?><?php
$b = "flo-block-item-title-2"; // To be used inside HTML

// Start: Class name automation
  $b__for_css = ".".$b; // To be used inside CSS
  $b__uniq = $b."--".mt_rand(1, 999); // To be used inside HTML
  $b__uniq_for_css = ".".$b__uniq; // To be used inside CSS
// End: Class name automation

/* START: CATEGORY */
  $display_category = flo_data($data, "display_category");

  switch ($post->post_type) {
    case 'post':
      $cat_term = 'category';
    break;
    case 'gallery':
      $cat_term = 'gallery-category';
    break;
    default:
      $cat_term = false;
    break;
  }
  $category = false;
  if ($cat_term && $categories_list) {
    $category = $categories_list;
  }

  $category_font = flo_data($data, "category_font");
/* END: CATEGORY */

$bgc = flo_data($data, "flo-block__custom_background_color");
$text_area_elements_color = flo_data($data, "text_area_elements_color");

$display_decorative_image = flo_data($data, "display_decorative_image");
$decorative_image = get_field("decorative-image");
$title_font = flo_data($data, "title_font");
$display_category = flo_data($data, "display_category");
$category_font = flo_data($data, "category_font");
$display_date = flo_data($data, "display_date");
$date_font = flo_data($data, "date_font");

$featured_image_height = flo_data($data, "featured_image_height") / 16 . "rem";
$featured_image_height_numeric = flo_data($data, "featured_image_height");
$display_featured_image = flo_data($data, "display_featured_image");
$display_featured_image = $display_featured_image && get_the_post_thumbnail_url();
$display_featured_image_class = $display_featured_image ? $b . "--display-featured-image" : "";
if(!$display_featured_image) {
  $featured_image_height = 'auto';
}
$mobile_featured_image_height = flo_data($data, "mobile_featured_image_height", 300) / 16 . "rem";
$mobile_featured_image_height_numeric = flo_data($data, "mobile_featured_image_height", 300);

$featured_image_url = get_the_post_thumbnail_url();

$featured_image_id = get_post_thumbnail_id();
$featured_image_alt = get_post_meta($featured_image_id, '_wp_attachment_image_alt', true) ;

//Image Optimization
$img_sizes = array(
         'mobile' => array('width' => 780, 'height' => $mobile_featured_image_height_numeric * 3),  // mobile size
         'tablet' => array('width' => 1188, 'height' => $featured_image_height_numeric * 2), // tablet size
         'desktop' => array('width' => 2228, 'height' => $featured_image_height_numeric * 3),
        );

        $img_vars = generate_srcsets($featured_image_url, $img_sizes, $crop = false);
?>

<?php $__env->startSection('block_content'); ?>
  <?php echo $__env->make('core.style', [
    "breakpoint__general" => "

      ".
      flo_render_typography_styles(
      $b__uniq_for_css." ".$b__for_css."__title",
      $title_font
      )
      ."

      ".
      flo_render_typography_styles(
      $b__uniq_for_css." ".$b__for_css."__category",
      $category_font
      )
      ."

      ".
      flo_render_typography_styles(
      $b__uniq_for_css." ".$b__for_css."__date",
      $date_font
      )
      ."

      ".$b__uniq_for_css." ".$b__for_css."__text-area {
        color: ".$text_area_elements_color.";
        background-color: ".$bgc.";
      }

    ",

    "breakpoint__medium_up" => "

      ".$b__uniq_for_css." ".$b__for_css."__featured-image-wrap {
        min-height: ".$featured_image_height.";
      }

    ",
    "breakpoint__small_only" => "
      ".$b__uniq_for_css." ".$b__for_css."__featured-image-wrap {
        height: ".$mobile_featured_image_height.";
      }
    "
  ], array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
  <div class="<?php echo $b; ?> <?php echo $b__uniq; ?> <?php echo $display_featured_image_class; ?>">
    <?php if($display_featured_image): ?>
      <div class="<?php echo $b; ?>__featured-image-wrap">
        <img class="<?php echo $b; ?>__featured-image"
          src ="<?php echo $featured_image_url; ?>"
          srcset="<?php echo $img_vars['srcsets']; ?>"
          sizes="<?php echo $img_vars['sizes']; ?>"
          alt="<?php echo $featured_image_alt; ?>"
        />
      </div>
    <?php endif; ?>
    <div class="<?php echo $b; ?>__text-area">
      <?php if($display_decorative_image && $decorative_image): ?>
        <img class="<?php echo $b; ?>__decorative-image" src="<?php echo $decorative_image["url"]; ?>" alt="<?php echo $decorative_image["alt"]; ?>">
      <?php endif; ?>
      <h1 class="<?php echo $b; ?>__title">
        <?php echo get_the_title(); ?>

      </h1>
      <?php if( ($display_category && $category) or $display_date): ?>
        <div class="<?php echo $b; ?>__date-and-category">
          <?php if($display_category && $category): ?>
            <h4 class="<?php echo $b; ?>__category">
              <?php echo $category; ?>

            </h4>
          <?php endif; ?>
          <?php if( ($display_category && $category) or $display_date): ?>
            <div class="<?php echo $b; ?>__separator"></div>
          <?php endif; ?>
          <?php if($display_date): ?>
            <h4 class="<?php echo $b; ?>__date">
              <?php echo get_the_date(); ?>

            </h4>
          <?php endif; ?>
        </div>
      <?php endif; ?>
    </div>
  </div>
<?php $__env->stopSection(true); ?>

<?php echo $__env->make('layout.block', [
  "block_classes" => "flo-block--no-top-padding", // Will be added to main block div. e.g. flo-block--full-width
  // "data_onready" => "block_name" // Specify a function (see _blank.js on how to define) that will be executed on document ready.
], array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>