refining kit press behaviour
This commit is contained in:
parent
f668e21b3a
commit
666a556ff0
|
|
@ -6,6 +6,8 @@ if (!function_exists('getRessourceIcon')) {
|
|||
function getRessourceIcon($ressource_type)
|
||||
{
|
||||
switch ($ressource_type) {
|
||||
case 'image/svg+xml':
|
||||
case 'image/png':
|
||||
case 'image/jpeg':
|
||||
return plugin_dir_url(__DIR__) . "src/img/homegrade_image.svg";
|
||||
|
||||
|
|
@ -17,6 +19,17 @@ if (!function_exists('getRessourceIcon')) {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (!function_exists('getRessourceTypeName')) {
|
||||
function getRessourceTypeName($subtype)
|
||||
{
|
||||
switch ($subtype) {
|
||||
case 'svg+xml':
|
||||
return "svg";
|
||||
default:
|
||||
return $subtype;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<section <?php echo get_block_wrapper_attributes(["class" => "homegrade-blocks-kit-presse"]); ?>>
|
||||
|
|
@ -34,22 +47,19 @@ if (!function_exists('getRessourceIcon')) {
|
|||
$ressourceType = $data['mime_type'];
|
||||
$ressourceIcon = getRessourceIcon($ressourceType);
|
||||
|
||||
|
||||
setlocale(LC_TIME, 'fr_FR');
|
||||
$timestamp = strtotime($data['modified']);
|
||||
$formatted_date = strftime("%B %Y", $timestamp);
|
||||
// echo '<pre>';
|
||||
// print_r($data);
|
||||
// echo '</pre>';
|
||||
|
||||
?>
|
||||
<li class="homegrade-blocks-kit-presse__press-ressource">
|
||||
<div class="homegrade-blocks-kit-presse__ressource-icon">
|
||||
<img src="<?php echo $ressourceIcon ?>" alt="">
|
||||
</div>
|
||||
<p class="homegrade-blocks-kit-presse__ressource-title"><?php echo $data['title'] ?></p>
|
||||
<p class="homegrade-blocks-kit-presse__ressource-type"><?php echo $data['subtype'] ?></p>
|
||||
<p class="homegrade-blocks-kit-presse__ressource-type"><?php echo getRessourceTypeName($data['subtype']) ?></p>
|
||||
<p class="homegrade-blocks-kit-presse__ressource-date"><?php echo $formatted_date ?></p>
|
||||
<a class="homegrade-blocks-kit-presse__ressource-download cta cta--secondary cta--button" href=""><?php echo __('Télécharger') ?></a>
|
||||
<a class="homegrade-blocks-kit-presse__ressource-download cta cta--secondary cta--button" href="<?php echo $data['url'] ?>" download><?php echo __('Télécharger', "homegrade-blocks__texte-fonctionnel") ?></a>
|
||||
|
||||
</li>
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ if (!function_exists('getRessourceIcon')) {
|
|||
function getRessourceIcon($ressource_type)
|
||||
{
|
||||
switch ($ressource_type) {
|
||||
case 'image/svg+xml':
|
||||
case 'image/png':
|
||||
case 'image/jpeg':
|
||||
return plugin_dir_url(__DIR__) . "src/img/homegrade_image.svg";
|
||||
|
||||
|
|
@ -17,6 +19,17 @@ if (!function_exists('getRessourceIcon')) {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (!function_exists('getRessourceTypeName')) {
|
||||
function getRessourceTypeName($subtype)
|
||||
{
|
||||
switch ($subtype) {
|
||||
case 'svg+xml':
|
||||
return "svg";
|
||||
default:
|
||||
return $subtype;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<section <?php echo get_block_wrapper_attributes(["class" => "homegrade-blocks-kit-presse"]); ?>>
|
||||
|
|
@ -34,22 +47,19 @@ if (!function_exists('getRessourceIcon')) {
|
|||
$ressourceType = $data['mime_type'];
|
||||
$ressourceIcon = getRessourceIcon($ressourceType);
|
||||
|
||||
|
||||
setlocale(LC_TIME, 'fr_FR');
|
||||
$timestamp = strtotime($data['modified']);
|
||||
$formatted_date = strftime("%B %Y", $timestamp);
|
||||
// echo '<pre>';
|
||||
// print_r($data);
|
||||
// echo '</pre>';
|
||||
|
||||
?>
|
||||
<li class="homegrade-blocks-kit-presse__press-ressource">
|
||||
<div class="homegrade-blocks-kit-presse__ressource-icon">
|
||||
<img src="<?php echo $ressourceIcon ?>" alt="">
|
||||
</div>
|
||||
<p class="homegrade-blocks-kit-presse__ressource-title"><?php echo $data['title'] ?></p>
|
||||
<p class="homegrade-blocks-kit-presse__ressource-type"><?php echo $data['subtype'] ?></p>
|
||||
<p class="homegrade-blocks-kit-presse__ressource-type"><?php echo getRessourceTypeName($data['subtype']) ?></p>
|
||||
<p class="homegrade-blocks-kit-presse__ressource-date"><?php echo $formatted_date ?></p>
|
||||
<a class="homegrade-blocks-kit-presse__ressource-download cta cta--secondary cta--button" href=""><?php echo __('Télécharger', "homegrade-blocks__texte-fonctionnel") ?></a>
|
||||
<a class="homegrade-blocks-kit-presse__ressource-download cta cta--secondary cta--button" href="<?php echo $data['url'] ?>" download><?php echo __('Télécharger', "homegrade-blocks__texte-fonctionnel") ?></a>
|
||||
|
||||
</li>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user