feat: Video inline cn

This commit is contained in:
Jérémy Munsch 2024-06-19 10:08:09 +02:00
parent 690aa696d5
commit 8ea69a06d0
No known key found for this signature in database
GPG key ID: 18361AF3BFEC0FEC
3 changed files with 137 additions and 199 deletions

View file

@ -304,84 +304,6 @@ SCRIPT;
</div>
<script>
window.LDCWebCN = {
'youtube': {
'name': "VIDEOS - Youtube",
'description': '<?php if (ICL_LANGUAGE_CODE === 'fr') : ?>Les cookies déposés via les services de partage de vidéo ont pour finalité de permettre à l’utilisateur de visionner directement sur le site le contenu multimédia.<?php else : ?>The purpose of cookies deposited via video sharing services is to allow the user to view multimedia content directly on the site.<?php endif; ?>',
'link': 'https://policies.google.com/technologies/cookies?hl=fr&utm_source=ucb',
'cookies': ['NID', 'VISITOR_INFO1_LIVE', 'YSC'],
'script': function() {
let youtubeVids = document.getElementsByClassName('ldcweb-cn-youtube');
for (let item of youtubeVids) {
let id = item.dataset.id;
let e = document.createElement('iframe');
e.src = "https://www.youtube.com/embed/" + id;
e.width = "640";
e.height = "360";
e.frameBorder = "0";
e.allow = "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture";
e.allowFullscreen = true;
item.innerHTML = "";
item.appendChild(e);
}
},
fallback: function() {
let youtubeVids = document.getElementsByClassName('ldcweb-cn-youtube');
for (let item of youtubeVids) {
let a = document.createElement('a');
a.innerText = '<?php if (ICL_LANGUAGE_CODE === 'fr') : ?>Autoriser<?php else : ?>Allow<?php endif; ?>';
a.href = '#';
a.classList.add('ldcweb-cn-cookieslink');
a.onclick = function() {
LDCWebCN.openModal();
};
let e = document.createElement('p');
e.innerHTML = '<?php if (ICL_LANGUAGE_CODE === 'fr') : ?>Youtube est désactivé.<?php else : ?>Youtube is disabled.<?php endif; ?>';
e.appendChild(a);
item.appendChild(e);
}
}
},
'vimeo': {
'name': "VIDEOS - Vimeo",
'description': '<?php if (ICL_LANGUAGE_CODE === 'fr') : ?>Les cookies déposés via les services de partage de vidéo ont pour finalité de permettre à l’utilisateur de visionner directement sur le site le contenu multimédia.<?php else : ?>The purpose of cookies deposited via video sharing services is to allow the user to view multimedia content directly on the site.<?php endif; ?>',
'link': 'https://vimeo.com/cookie_policy',
'cookies': [],
'script': function() {
let vimeoVids = document.getElementsByClassName('ldcweb-cn-vimeo');
for (let item of vimeoVids) {
let id = item.dataset.id;
let e = document.createElement('iframe');
e.src = "https://player.vimeo.com/video/" + id;
e.width = "640";
e.height = "360";
e.frameBorder = "0";
e.allow = "autoplay; fullscreen; picture-in-picture";
e.allowFullscreen = true;
item.innerHTML = "";
item.appendChild(e);
}
},
fallback: function() {
let vimeoVids = document.getElementsByClassName('ldcweb-cn-vimeo');
for (let item of vimeoVids) {
let a = document.createElement('a');
a.innerText = '<?php if (ICL_LANGUAGE_CODE === 'fr') : ?>Autoriser<?php else : ?>Allow<?php endif; ?>';
a.href = '#';
a.classList.add('ldcweb-cn-cookieslink');
a.onclick = function() {
LDCWebCN.openModal();
};
let e = document.createElement('p');
e.innerHTML = '<?php if (ICL_LANGUAGE_CODE === 'fr') : ?>Vimeo est désactivé.<?php else : ?>Vimeo is disabled.<?php endif; ?>';
e.appendChild(a);
item.appendChild(e);
}
}
}
};
</script>
<script nonce="{{ $nonce ?? '' }}">

View file

@ -9,14 +9,13 @@ Template Name: Page Rejoin
<?php
global $tp;
if (get_locale()==='fr_FR'){
if (get_locale() === 'fr_FR') {
$slug = 'experience';
} else {
$slug = 'votre_parcours';
}
$videos = get_field('videos');
$experience = get_field($slug);
// $experience = get_field('experience');
$policy = get_field('policy');
$concern = get_field('concern');
$events = get_field('events');
@ -37,26 +36,33 @@ $map_image = get_field('map_image');
?>
</div>
<?php if(!empty($videos)) : ?>
<?php if (!empty($videos)) : ?>
<div class="videos fw fw-container no-top-padding">
<div class="videos__wrapper wrapper">
<?php if(!empty($videos['videos'])) : ?>
<?php if (!empty($videos['videos'])) : ?>
<div class="videos__container">
<?php foreach($videos['videos'] as $v) : ?>
<?php foreach ($videos['videos'] as $v) : ?>
<div class="videos-list">
<h3 class="videos__title subtitle"><?php echo $v['title'] ?></h3>
<h3 class="videos__title subtitle"><?= wp_kses_post($v['title']) ?></h3>
<div class="videos__info">
<div class="videos__info-inner">
<?php if(!empty($v['list'])) : ?>
<?php if (!empty($v['list'])) : ?>
<div class="videos-list">
<?php shuffle($v['list']); ?>
<?php foreach(array_slice($v['list'], 0, 3) as $l) : ?>
<?php foreach (array_slice($v['list'], 0, 3) as $l) : ?>
<div class="video">
<div class="video__wrap">
<div class="play-button"></div>
<div class="ldcweb-cn-<?= $l['type']; ?>" data-id="<?= $l['file']; ?>"></div>
<?php
$videoUrl = strpos($l['file'], 'https') === 0 ?
$l['file'] : (
$l['type'] === 'youtube' ?
'https://www.youtube.com/embed/' : 'https://player.vimeo.com/video/'
) . $l['file'];
?>
<div class="cn-<?= esc_attr($l['type']); ?>" data-src="<?= esc_url($videoUrl); ?>"></div>
</div>
<div class="video__title"><?php echo $l['title'] ?></div>
<div class="video__title"><?= wp_kses_post($l['title']) ?></div>
</div>
<?php endforeach; ?>
</div>
@ -68,13 +74,15 @@ $map_image = get_field('map_image');
</div>
<?php endif; ?>
<?php if(!empty($videos['text'])) : ?>
<div class="videos__text description"><?php echo $videos['text'] ?></div>
<?php if (!empty($videos['text'])) : ?>
<div class="videos__text description"><?= wp_kses_post($videos['text']) ?></div>
<?php endif; ?>
<?php if(!empty($videos['button'])) : ?>
<?php if (!empty($videos['button'])) : ?>
<div class="videos__btn-wrap">
<a class="videos__btn btn" href="<?php echo $videos['button']['url'] ?>" target="<?php echo $videos['button']['target'] ?>" title="<?php echo $videos['button']['title'] ?>"><?php echo $videos['button']['title'] ?> <i class="btn__icon btn__icon_arrow-right"></i></a>
<a class="videos__btn btn" href="<?= esc_url($videos['button']['url']) ?>" target="<?= esc_attr($videos['button']['target']) ?>" title="<?= esc_attr($videos['button']['title']) ?>">
<?= wp_kses_post($videos['button']['title']) ?> <i class="btn__icon btn__icon_arrow-right"></i>
</a>
</div>
<?php endif; ?>
</div>
@ -82,45 +90,47 @@ $map_image = get_field('map_image');
<?php endif; ?>
<div data-anchor="<?php _e('Your career at LDC', 'LDC Custom string'); ?>">
<?php if(!empty($experience)) : ?>
<?php if (!empty($experience)) : ?>
<div class="experience fw fw-container gray-bg">
<div class="experience__wrapper wrapper">
<?php if(!empty($experience['title']) || !empty($experience['subtitle']['text'])) : ?>
<?php if (!empty($experience['title']) || !empty($experience['subtitle']['text'])) : ?>
<h2 class="experience__title textblock__title title">
<?php if(!empty($experience['title'])) : ?>
<span class="title-text"><?php echo $experience['title']; ?></span>
<?php if (!empty($experience['title'])) : ?>
<span class="title-text"><?= wp_kses_post($experience['title']) ?></span>
<?php endif; ?>
<?php if(!empty($experience['subtitle'])) : ?>
<span class="experience__subtitle subtitle-text textblock__subtitle subtitle subtitle_paint"><?php echo $experience['subtitle']; ?></span>
<?php if (!empty($experience['subtitle'])) : ?>
<span class="experience__subtitle subtitle-text textblock__subtitle subtitle subtitle_paint"><?= wp_kses_post($experience['subtitle']) ?></span>
<?php endif; ?>
</h2>
<?php endif; ?>
<?php if(!empty($experience['image'])) : ?>
<div class="experience__image"><img src="<?php echo $experience['image'] ?>" alt="<?php echo (!empty($experience['title']) ? $experience['title'] : ' '); ?>" /></div>
<?php endif; ?>
<?php if(!empty($experience['votre_integration'])) : ?>
<div class="experience__textblock">
<h3 class="experience__textblock-subtitle subtitle"><?php echo $experience['votre_integration']['title'] ?></h3>
<div class="experience__textblock-text description"><?php echo $experience['votre_integration']['text'] ?></div>
<?php if (!empty($experience['image'])) : ?>
<div class="experience__image">
<img src="<?= esc_url($experience['image']) ?>" alt="<?= esc_attr(!empty($experience['title']) ? $experience['title'] : ' ') ?>" />
</div>
<?php endif; ?>
<?php if(!empty($experience['votre_parcours_de_formation'])) : ?>
<?php if (!empty($experience['votre_integration'])) : ?>
<div class="experience__textblock">
<h3 class="experience__textblock-subtitle subtitle"><?php echo $experience['votre_parcours_de_formation']['title'] ?></h3>
<div class="experience__textblock-text description"><?php echo $experience['votre_parcours_de_formation']['text'] ?></div>
<h3 class="experience__textblock-subtitle subtitle"><?= wp_kses_post($experience['votre_integration']['title']) ?></h3>
<div class="experience__textblock-text description"><?= wp_kses_post($experience['votre_integration']['text']) ?></div>
</div>
<?php if(!empty($experience['votre_parcours_de_formation']['list'])) : ?>
<?php endif; ?>
<?php if (!empty($experience['votre_parcours_de_formation'])) : ?>
<div class="experience__textblock">
<h3 class="experience__textblock-subtitle subtitle"><?= wp_kses_post($experience['votre_parcours_de_formation']['title']) ?></h3>
<div class="experience__textblock-text description"><?= wp_kses_post($experience['votre_parcours_de_formation']['text']) ?></div>
</div>
<?php if (!empty($experience['votre_parcours_de_formation']['list'])) : ?>
<div class="training-path">
<?php foreach($experience['votre_parcours_de_formation']['list'] as $vl) : ?>
<?php foreach ($experience['votre_parcours_de_formation']['list'] as $vl) : ?>
<div class="training-path__item training-path-item">
<div class="training-path-item__image"><img src="<?php echo $vl['image'] ?>" alt="<?php echo $vl['title'] ?>"></div>
<div class="training-path-item__image"><img src="<?= esc_url($vl['image']) ?>" alt="<?= esc_attr($vl['title']) ?>"></div>
<div class="training-path-item__description description">
<div class="training-path-item__title"><?php echo $vl['title'] ?></div>
<div class="training-path-item__text"><?php echo $vl['text'] ?></div>
<div class="training-path-item__title"><?= wp_kses_post($vl['title']) ?></div>
<div class="training-path-item__text"><?= wp_kses_post($vl['text']) ?></div>
</div>
</div>
<?php endforeach; ?>
@ -134,10 +144,10 @@ $map_image = get_field('map_image');
<?php endif; ?>
<?php if(!empty($experience['votre_mobilite_au_sein_du_groupe'])) : ?>
<?php if (!empty($experience['votre_mobilite_au_sein_du_groupe'])) : ?>
<div class="experience__textblock">
<h3 class="experience__textblock-subtitle subtitle"><?php echo $experience['votre_mobilite_au_sein_du_groupe']['title'] ?></h3>
<div class="experience__textblock-text description"><?php echo $experience['votre_mobilite_au_sein_du_groupe']['text'] ?></div>
<h3 class="experience__textblock-subtitle subtitle"><?= wp_kses_post($experience['votre_mobilite_au_sein_du_groupe']['title']) ?></h3>
<div class="experience__textblock-text description"><?= wp_kses_post($experience['votre_mobilite_au_sein_du_groupe']['text']) ?></div>
</div>
<?php
@ -163,7 +173,7 @@ $map_image = get_field('map_image');
<div data-anchor="<?php _e('Our Human Resources policy', 'LDC Custom string'); ?>">
<?php if(!empty($policy)) : ?>
<?php if (!empty($policy)) : ?>
<?php
set_query_var('text_block', $policy['text_block']);
set_query_var('custom_class', 'notre-politique');
@ -173,33 +183,33 @@ $map_image = get_field('map_image');
</div>
<div data-anchor="<?php _e('Your well-being…our concern', 'LDC Custom string'); ?>">
<?php if(!empty($concern)) : ?>
<?php if (!empty($concern)) : ?>
<?php
set_query_var('text_block', $concern['text_block']);
set_query_var('custom_class', 'votre-bien-etre');
get_template_part('partials/text-block');
?>
<?php if(!empty($concern['events_thumbs'])) : ?>
<?php if (!empty($concern['events_thumbs'])) : ?>
<?php $thumbs = $concern['events_thumbs']; ?>
<div class="events-thumbs fw fw-container gray-bg no-top-padding">
<div class="events-thumbs__wrapper wrapper">
<?php if(!empty($thumbs['text'])) : ?>
<div class="events-thumbs__text description"><?php echo $thumbs['text'] ?></div>
<?php if (!empty($thumbs['text'])) : ?>
<div class="events-thumbs__text description"><?= wp_kses_post($thumbs['text']) ?></div>
<?php endif; ?>
<?php if(!empty($thumbs['list'])) : ?>
<?php if (!empty($thumbs['list'])) : ?>
<div class="events-thumbs__list-wrap events-thumbs-list-wrap">
<div class="events-thumbs-list">
<?php foreach($thumbs['list'] as $t) : ?>
<?php foreach ($thumbs['list'] as $t) : ?>
<div class="events-thumbs-list__item">
<div class="events-thumbs-list__item-image image-border-wrap gray-bg">
<img src="<?php echo $t['image'] ?>" alt="<?php echo $t['text'] ?>" />
<img src="<?= esc_url($t['image']) ?>" alt="<?= esc_attr($t['text']) ?>" />
<?php
set_query_var('borders', $t['image_borders']);
get_template_part('partials/borders');
?>
</div>
<div class="events-thumbs-list__item-text description"><?php echo $t['text'] ?></div>
<div class="events-thumbs-list__item-text description"><?= wp_kses_post($t['text']) ?></div>
</div>
<?php endforeach; ?>
</div>
@ -212,40 +222,40 @@ $map_image = get_field('map_image');
</div>
<div data-anchor="<?php _e('Our forum & jobdating events', 'LDC Custom string'); ?>">
<?php if(!empty($events)) : ?>
<?php if (!empty($events)) : ?>
<div class="events fw fw-container">
<div class="events__wrapper wrapper">
<?php if(!empty($events['title']) || !empty($events['subtitle']['text'])) : ?>
<?php if (!empty($events['title']) || !empty($events['subtitle']['text'])) : ?>
<h2 class="events__title textblock__title title">
<?php if(!empty($events['title'])) : ?>
<span class="title-text"><?php echo $events['title']; ?></span>
<?php if (!empty($events['title'])) : ?>
<span class="title-text"><?= wp_kses_post($events['title']) ?></span>
<?php endif; ?>
<?php if(!empty($events['subtitle'])) : ?>
<span class="events__subtitle subtitle-text textblock__subtitle subtitle subtitle_paint"><?php echo $events['subtitle']; ?></span>
<?php if (!empty($events['subtitle'])) : ?>
<span class="events__subtitle subtitle-text textblock__subtitle subtitle subtitle_paint"><?= wp_kses_post($events['subtitle']) ?></span>
<?php endif; ?>
</h2>
<?php endif; ?>
<?php if(!empty($events['text'])) : ?>
<div class="events__text description"><?php echo $events['text'] ?></div>
<?php if (!empty($events['text'])) : ?>
<div class="events__text description"><?= wp_kses_post($events['text']) ?></div>
<?php endif; ?>
<?php if(!empty($events['maps'])) : ?>
<?php if (!empty($events['maps'])) : ?>
<div class="events__maps">
<?php foreach($events['maps'] as $m) : ?>
<?php foreach ($events['maps'] as $eMap) : ?>
<div class="events__map events-map">
<h3 class="events-map__title subtitle"><?php echo $m['title'] ?></h3>
<div class="events-map__item gray-bg"><img src="<?php echo $m['image'] ?>" alt="<?php echo $m['title'] ?>" /></div>
<h3 class="events-map__title subtitle"><?= wp_kses_post($eMap['title']) ?></h3>
<div class="events-map__item gray-bg"><img src="<?= esc_url($eMap['image']) ?>" alt="<?= esc_attr($eMap['title']) ?>" /></div>
<ul class="events-map__cities events-cities">
<?php foreach($m['cities'] as $c) : ?>
<?php foreach ($eMap['cities'] as $city) : ?>
<li class="events-cities__item description">
<div class="events-cities__item-name"><?php echo $c['city'] ?></div>
<?php if (is_array($c['places'])) : ?>
<?php foreach($c['places'] as $p) : ?>
<div class="events-cities__item-name"><?= wp_kses_post($city['city']) ?></div>
<?php if (is_array($city['places'])) : ?>
<?php foreach ($city['places'] as $place) : ?>
<div class="events-cities__item-place">
<span><?php echo $p['title'] ?></span><?php echo $p['text'] ?>
<span><?= wp_kses_post($place['title']) ?></span><?= wp_kses_post($place['text']) ?>
</div>
<?php endforeach; ?>
<?php endif; ?>
@ -268,7 +278,7 @@ $map_image = get_field('map_image');
<?php get_template_part('partials/list-items', 'events'); ?>
</div>
<?php $lang = ICL_LANGUAGE_CODE; ?>
<?php if($lang == 'en') : ?>
<?php if ($lang == 'en') : ?>
<a class="btn" href="/en/category/news-en/?tag=evenements-en" title="Voir tous nos évènements, forums et job dating">Discover all our events, forums and job dating <i class="btn__icon btn__icon_arrow-right"></i></a>
<?php else : ?>
<a class="btn" href="/category/news/?tag=evenements,salon" title="Voir tous nos évènements, forums et job dating">Voir tous nos évènements, forums et job dating <i class="btn__icon btn__icon_arrow-right"></i></a>
@ -277,7 +287,7 @@ $map_image = get_field('map_image');
</div>
<div data-anchor="<?php _e('Schools, come and visit us', 'LDC Custom string'); ?>">
<?php if(!empty($schools)) : ?>
<?php if (!empty($schools)) : ?>
<?php
set_query_var('addclass', 'no-bottom-padding');
set_query_var('text_block', $schools['text_block']);
@ -287,54 +297,62 @@ $map_image = get_field('map_image');
<?php endif; ?>
</div>
<?php if(!empty($map_image)) : ?>
<?php if (!empty($map_image)) : ?>
<div class="rejoin-map fw fw-container gray-bg">
<div class="rejoin-map__wrapper wrapper">
<div class="rejoin-map__content" style="background-image: url(<?php echo $map_image['image']; ?>)">
<a class="rejoin-map__btn btn" href="<?php echo $map_image['button']['url']; ?>"><?php echo $map_image['button']['title']; ?><i class="btn__icon btn__icon_arrow-right"></i></a>
<div class="rejoin-map__content" style="background-image: url(<?= esc_url($map_image['image']) ?>)">
<a class="rejoin-map__btn btn" href="<?= esc_url($map_image['button']['url']) ?>">
<?= wp_kses_post($map_image['button']['title']) ?><i class="btn__icon btn__icon_arrow-right"></i></a>
</div>
</div>
</div>
<?php endif; ?>
<div data-anchor="<?php _e('Farmers, join us !', 'LDC Custom string'); ?>">
<?php if(!empty($breeders)) : ?>
<?php if (!empty($breeders)) : ?>
<div class="breeders fw fw-container">
<div class="breeders__wrapper wrapper">
<?php if(!empty($breeders['title']) || !empty($breeders['subtitle']['text'])) : ?>
<?php if (!empty($breeders['title']) || !empty($breeders['subtitle']['text'])) : ?>
<h2 class="breeders__title textblock__title title">
<?php if(!empty($breeders['title'])) : ?>
<span class="title-text"><?php echo $breeders['title']; ?></span>
<?php if (!empty($breeders['title'])) : ?>
<span class="title-text"><?= wp_kses_post($breeders['title']); ?></span>
<?php endif; ?>
<?php if(!empty($breeders['subtitle'])) : ?>
<span class="breeders__subtitle subtitle-text textblock__subtitle subtitle subtitle_paint"><?php echo $breeders['subtitle']; ?></span>
<?php if (!empty($breeders['subtitle'])) : ?>
<span class="breeders__subtitle subtitle-text textblock__subtitle subtitle subtitle_paint"><?= wp_kses_post($breeders['subtitle']) ?></span>
<?php endif; ?>
</h2>
<?php endif; ?>
<div class="textblock__container">
<div class="textblock__block">
<?php if(!empty($breeders['text'])) : ?>
<div class="breeders__text description textblock__info-description"><?php echo $breeders['text'] ?></div>
<?php if (!empty($breeders['text'])) : ?>
<div class="breeders__text description textblock__info-description"><?= wp_kses_post($breeders['text']) ?></div>
<?php endif; ?>
<?php if(!empty($breeders['button'])) : ?>
<a class="breeders__btn btn" href="<?php echo $breeders['button']['url'] ?>" title="<?php echo $breeders['button']['title'] ?>"><?php echo $breeders['button']['title'] ?> <i class="btn__icon btn__icon_arrow-right"></i></a>
<?php if (!empty($breeders['button'])) : ?>
<a class="breeders__btn btn" href="<?= esc_url($breeders['button']['url']) ?>" title="<?= esc_attr($breeders['button']['title']) ?>"><?= wp_kses_post($breeders['button']['title']) ?> <i class="btn__icon btn__icon_arrow-right"></i></a>
<?php endif; ?>
</div>
</div>
<?php if(!empty($breeders['videos'])) : ?>
<?php if (!empty($breeders['videos'])) : ?>
<div class="breeders__videos videos-list">
<?php foreach($breeders['videos'] as $v) : ?>
<?php foreach ($breeders['videos'] as $v) : ?>
<div class="video">
<div class="video__wrap">
<div class="play-button"></div>
<div class="ldcweb-cn-<?= $v['type']; ?>" data-id="<?= $v['file']; ?>"></div>
<?php
$videoUrl = strpos($v['file'], 'https') === 0 ?
$v['file'] : (
$v['type'] === 'youtube' ?
'https://www.youtube.com/embed/' : 'https://player.vimeo.com/video/'
) . $v['file'];
?>
<div class="cn-<?= esc_attr($v['type']); ?>" data-src="<?= esc_url($videoUrl); ?>"></div>
</div>
<div class="video__title"><?php echo $v['title'] ?></div>
<div class="video__title"><?= wp_kses_post($v['title']) ?></div>
</div>
<?php endforeach; ?>
</div>
@ -347,12 +365,12 @@ $map_image = get_field('map_image');
</div>
<script>
$(document).find('[data-anchor]').each(function(i){
var anchor_id = 'rejoin_'+i;
$(document).find('[data-anchor]').each(function(i) {
var anchor_id = 'rejoin_' + i;
var anchor_text = $(this).attr('data-anchor');
$(this).attr('id', anchor_id);
link = '<a class="anchor-scroll" href="#'+anchor_id+'">'+anchor_text+'</a>';
link = '<a class="anchor-scroll" href="#' + anchor_id + '">' + anchor_text + '</a>';
$(document).find('.offer-anchors').append(link);
});

View file

@ -1,39 +1,37 @@
<?php
if(empty($video)) {
$video = get_field('additional_video_text_video_block');
}
//var_dump($video);
if (empty($video)) {
$video = get_field('additional_video_text_video_block');
}
?>
<?php if($video['show_block']) : ?>
<div class="blocvideo fw">
<div class="blocvideo__wrapper wrapper">
<?php if(!empty($video['title'])) : ?>
<h2 class="manifest__title textblock__title title">
<span class="title-text"><?php echo $video['title']; ?></span>
<?php if(!empty($video['subtitle'])) : ?>
<span class="manifest__subtitle subtitle-text textblock__subtitle subtitle <?php if($video['subtitle']['cursive']) : ?>subtitle_paint<?php endif; ?>"><?php echo $video['subtitle']['text']; ?></span>
<?php endif; ?>
</h2>
<?php endif; ?>
<?php if(!empty($video['video'])) : ?>
<div class="home_video">
<div class="video__wrap">
<div class="play-button"></div>
<?php
//if($video['type_video'] == 'vimeo') {
$dasVideoId = str_replace("https://player.vimeo.com/video/","",$video['video']);
$dasVideoId = str_replace("https://www.youtube.com/embed/","",$dasVideoId);
$dasVideoId = str_replace("https://www.youtube.com/watch?v=","",$dasVideoId);
$dasVideoId = str_replace("https://youtu.be/","",$dasVideoId);
// }
?>
<div class="ldcweb-cn-<?= $video['type_video']; ?>" data-id="<?= $dasVideoId; ?>"></div>
<?php if ($video['show_block']) : ?>
<div class="blocvideo fw">
<div class="blocvideo__wrapper wrapper">
<?php if (!empty($video['title'])) : ?>
<h2 class="manifest__title textblock__title title">
<span class="title-text"><?= esc_html($video['title']) ?></span>
<?php if (!empty($video['subtitle'])) : ?>
<span class="manifest__subtitle subtitle-text textblock__subtitle subtitle <?php if ($video['subtitle']['cursive']) : ?>subtitle_paint<?php endif; ?>"><?= esc_html($video['subtitle']['text']) ?></span>
<?php endif; ?>
</h2>
<?php endif; ?>
<?php if (!empty($video['video'])) : ?>
<div class="home_video">
<div class="video__wrap">
<div class="play-button"></div>
<?php
$videoUrl = strpos($video['video'], 'https') === 0 ?
$video['video'] : (
$video['type_video'] === 'youtube' ?
'https://www.youtube.com/embed/' : 'https://player.vimeo.com/video/'
) . $video['video'];
?>
<div class="cn-<?= esc_attr($video['type_video']); ?>" data-src="<?= esc_url($videoUrl); ?>"></div>
</div>
</div>
</div>
<?php endif; ?>
<?php if(!empty($video['texte'])) : ?>
<div class="engagements__description description"><?php echo $video['texte']; ?></div>
<?php endif; ?>
<?php endif; ?>
<?php if (!empty($video['texte'])) : ?>
<div class="engagements__description description"><?= esc_html($video['texte']) ?></div>
<?php endif; ?>
</div>
</div>
</div>
<?php endif; ?>