<?php
    $newsData = array();
    $newsData['title'] = get_the_title($news->ID);
    $newsData['publishDate'] = get_field('publishDate', $news->ID);
    $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'] = substr($newsData['category']->name, 0, 1);
    $newsData['categoryName'] = $newsData['category']->name;
?>
<div class="newsBloc">
    <?php if ($newsData['file']): ?>
        <a href="<?php echo $newsData['file']['url']; ?>" target="_blank" class="newsBloc_link" aria-label="<?php echo pradel_format_attr($newsData['title']); ?>"></a>
    <?php elseif ($newsData['videoLink']): ?>
        <a href="#" class="newsBloc_link" data-news-id="<?php echo $news->ID; ?>" aria-label="<?php echo pradel_format_attr($newsData['title']); ?>"></a>
    <?php endif; ?>
    <div class="newsBloc_header">
        <div class="newsBloc_date"><?php echo $newsData['publishDate']; ?></div>
        <div class="newsBloc_type newsBloc_type--<?php echo $newsData['categoryLetter']; ?>">
            <span class="newsBloc_type_fake"><?php echo $newsData['categoryLetter']; ?></span>
            <span class="newsBloc_type_label"><?php echo $newsData['categoryName']; ?></span>
        </div>
    </div>
    <div class="newsBloc_content">
        <div class="newsBloc_title"><?php echo $newsData['title']; ?></div>
        <div class="newsBloc_excerpt"><?php echo $newsData['intro']; ?></div>
    </div>
</div>