<?php
    $newsData = array();
    $newsData['title'] = get_the_title($news->ID);
    
    $d = DateTime::createFromFormat('d/m/Y', get_field('publishDate', $news->ID))->format('Y-m-d');
    $dateStrToTime = strtotime($d);
    $newsData['shortDate'] = date_i18n('j M', $dateStrToTime);

    $newsData['intro'] = get_field('intro', $news->ID);
    $newsData['file'] = get_field('file', $news->ID);
    $newsData['videoLink'] = get_field('videoLink', $news->ID);
    $c = wp_get_post_terms($news->ID, 'category');
    $newsData['category'] = count($c) > 0 ? $c[0] : null;
    $newsData['categoryLetter'] = $newsData['category'] ? substr($newsData['category']->name, 0, 1) : null;
?>
<div class="newsBlocHeader">
    <?php if ($newsData['file']): ?>
        <a href="<?php echo $newsData['file']['url']; ?>" target="_blank" class="newsBlocHeader_link" aria-label="<?php echo pradel_format_attr($newsData['title']); ?>"></a>
    <?php elseif ($newsData['videoLink']): ?>
        <a href="#" class="newsBlocHeader_link" data-news-id="<?php echo $news->ID; ?>" aria-label="<?php echo pradel_format_attr($newsData['title']); ?>"></a>
    <?php endif; ?>
    <div class="newsBlocHeader_content">
        <div class="newsBlocHeader_title">
            <span><?php echo $newsData['title']; ?></span>
        </div>
    </div>
    <div class="newsBlocHeader_footer">
        <?php echo $newsData['categoryLetter']; ?> - <?php echo $newsData['shortDate']; ?>
    </div>
</div>