FEATURE Handling mains authors and publication directors

This commit is contained in:
Antoine M 2026-03-20 16:54:15 +01:00
parent 8c5dd8cb02
commit 20398a32d9

View File

@ -2,19 +2,54 @@
$postId = $args['postId'];
$componentTitle = 'Auteur·e·s de l\'article';
$authors = get_field('authors', $postId);
$has_main_author = get_field('has_main_author', $postId);
$main_author = get_field('main_author', $postId);
$show_author_status = $has_main_author && $main_author ? true : false;
$has_publication_direction = get_field('has_publication_direction', $postId);
$publication_directors = get_field('publication_directors', $postId);
?>
<section class="authors-list">
<h3 class="authors-list__title"><?php echo $componentTitle; ?></h3>
<?php foreach ($authors as $author) : ?>
<?php if ($has_main_author && $main_author) : ?>
<?php get_template_part(
'template-parts/components/cards/author-card',
null,
array(
'ID' => $main_author->ID,
'show_author_status' => $show_author_status,
'author_status' => 'main-author',
)
); ?>
<?php endif; ?>
<?php foreach ($authors as $author) : ?>
<?php get_template_part(
'template-parts/components/cards/author-card',
null,
array(
'ID' => $author->ID,
'show_author_status' => $show_author_status,
'author_status' => 'author',
)
); ?>
<?php endforeach; ?>
<?php if ($has_publication_direction && $publication_directors) : ?>
<h3 class="authors-list__title"><?php echo "Sous la direction de"; ?></h3>
<?php foreach ($publication_directors as $publication_director) : ?>
<?php get_template_part(
'template-parts/components/cards/author-card',
null,
array(
'ID' => $publication_director->ID,
'show_author_status' => $show_author_status,
'author_status' => 'publication-director',
)
); ?>
<?php endforeach; ?>
<?php endif; ?>
</section>