REBUILDING
This commit is contained in:
parent
d1b212ab74
commit
706f394438
|
|
@ -14,7 +14,11 @@ return array(
|
|||
|
||||
),
|
||||
'supports' => array(
|
||||
'html' => false
|
||||
'html' => false,
|
||||
'color' => array(
|
||||
'background' => true,
|
||||
'text' => true
|
||||
)
|
||||
),
|
||||
'textdomain' => 'dernieres-dynamiques',
|
||||
'editorScript' => 'file:./index.js',
|
||||
|
|
@ -26,6 +30,10 @@ return array(
|
|||
'displayType' => array(
|
||||
'type' => 'string',
|
||||
'default' => 'grid'
|
||||
),
|
||||
'showTableOfContents' => array(
|
||||
'type' => 'boolean',
|
||||
'default' => true
|
||||
)
|
||||
)
|
||||
),
|
||||
|
|
|
|||
|
|
@ -9,7 +9,11 @@
|
|||
"description": "Example block scaffolded with Create Block tool.",
|
||||
"example": {},
|
||||
"supports": {
|
||||
"html": false
|
||||
"html": false,
|
||||
"color": {
|
||||
"background": true,
|
||||
"text": true
|
||||
}
|
||||
},
|
||||
"textdomain": "dernieres-dynamiques",
|
||||
"editorScript": "file:./index.js",
|
||||
|
|
@ -21,6 +25,10 @@
|
|||
"displayType": {
|
||||
"type": "string",
|
||||
"default": "grid"
|
||||
},
|
||||
"showTableOfContents": {
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +1 @@
|
|||
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-i18n', 'wp-server-side-render'), 'version' => 'dd3694142dcbdb8c8bb7');
|
||||
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-i18n', 'wp-server-side-render'), 'version' => '79dc145297e0d0e5c73e');
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
\*********************************************/
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = /*#__PURE__*/JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"dynamiques-blocks/dernieres-dynamiques","version":"0.1.0","title":"Dernieres Dynamiques","category":"dynamiques-blocks","icon":"smiley","description":"Example block scaffolded with Create Block tool.","example":{},"supports":{"html":false},"textdomain":"dernieres-dynamiques","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","viewScript":"file:./view.js","render":"file:./render.php","attributes":{"displayType":{"type":"string","default":"grid"}}}');
|
||||
module.exports = /*#__PURE__*/JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"dynamiques-blocks/dernieres-dynamiques","version":"0.1.0","title":"Dernieres Dynamiques","category":"dynamiques-blocks","icon":"smiley","description":"Example block scaffolded with Create Block tool.","example":{},"supports":{"html":false,"color":{"background":true,"text":true}},"textdomain":"dernieres-dynamiques","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","viewScript":"file:./view.js","render":"file:./render.php","attributes":{"displayType":{"type":"string","default":"grid"},"showTableOfContents":{"type":"boolean","default":true}}}');
|
||||
|
||||
/***/ }),
|
||||
|
||||
|
|
@ -44,18 +44,24 @@ function Edit({
|
|||
setAttributes
|
||||
}) {
|
||||
const {
|
||||
displayType
|
||||
displayType,
|
||||
showTableOfContents = true
|
||||
} = attributes;
|
||||
function onDisplayTypeChange(value) {
|
||||
setAttributes({
|
||||
displayType: value
|
||||
});
|
||||
}
|
||||
function onShowTableOfContentsChange(value) {
|
||||
setAttributes({
|
||||
showTableOfContents: !showTableOfContents
|
||||
});
|
||||
}
|
||||
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.Fragment, {
|
||||
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.InspectorControls, {
|
||||
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.PanelBody, {
|
||||
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.PanelBody, {
|
||||
title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("Paramètres", "dernieres-dynamiques"),
|
||||
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.__experimentalToggleGroupControl, {
|
||||
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.__experimentalToggleGroupControl, {
|
||||
className: "homegrade-blocks-highlight__variant",
|
||||
isBlock: true,
|
||||
label: "Type d'affichage des posts",
|
||||
|
|
@ -68,7 +74,11 @@ function Edit({
|
|||
label: "Grille",
|
||||
value: "grid"
|
||||
})]
|
||||
})
|
||||
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.CheckboxControl, {
|
||||
label: "Afficher la table des mati\xE8res",
|
||||
checked: showTableOfContents,
|
||||
onChange: onShowTableOfContentsChange
|
||||
})]
|
||||
})
|
||||
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div", {
|
||||
...(0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps)({
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,6 +1,14 @@
|
|||
<?php
|
||||
$displayType = $attributes['displayType'] ?? 'grid';
|
||||
$variantLocation = $attributes['variantLocation'] ?? 'carhop';
|
||||
$showTableOfContents = $attributes['showTableOfContents'] ?? true;
|
||||
$backgroundColor = $attributes['backgroundColor'] ?? null;
|
||||
$backgroundColorHex = get_color_hex_from_slug($backgroundColor) ?? null;
|
||||
write_log($backgroundColorHex);
|
||||
|
||||
$hasLightBackground = is_color_light($backgroundColorHex);
|
||||
$backgroundColorClass = $hasLightBackground ? 'block-dernieres-dynamiques--has-light-bg' : 'block-dernieres-dynamiques--has-dark-bg';
|
||||
|
||||
|
||||
$current_blog_id = get_current_blog_id();
|
||||
switch_to_blog(2);
|
||||
|
|
@ -23,7 +31,7 @@ $issue_related_articles = get_field('articles', $last_issue->ID);
|
|||
?>
|
||||
|
||||
|
||||
<section class="block-dernieres-dynamiques content-section block-dernieres-dynamiques--<?php echo $variantLocation; ?> alignfull">
|
||||
<section <?php echo get_block_wrapper_attributes(array('class' => 'block-dernieres-dynamiques content-section block-dernieres-dynamiques--' . $variantLocation . ' alignfull ' . $backgroundColorClass)); ?>>
|
||||
<div class="block-dernieres-dynamiques__inner">
|
||||
<div class="block-dernieres-dynamiques__header">
|
||||
<h2 class="block-title">
|
||||
|
|
@ -84,80 +92,82 @@ $issue_related_articles = get_field('articles', $last_issue->ID);
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="related-articles">
|
||||
<h3 class="related-articles__title">
|
||||
Table des matières
|
||||
</h3>
|
||||
<?php if ($showTableOfContents) : ?>
|
||||
|
||||
<div class="related-articles">
|
||||
<h3 class="related-articles__title">
|
||||
Table des matières
|
||||
</h3>
|
||||
|
||||
|
||||
<div class="article-caroussel article-caroussel--<?php echo $displayType; ?>">
|
||||
<div class="article-caroussel article-caroussel--<?php echo $displayType; ?>">
|
||||
|
||||
<?php if ($displayType === 'grid') : ?>
|
||||
<?php if ($displayType === 'grid') : ?>
|
||||
|
||||
<?php foreach ($issue_related_articles as $article) : ?>
|
||||
<?php
|
||||
get_template_part('template-parts/dynamiques/article-card', null, array(
|
||||
'ID' => $article->ID,
|
||||
<?php foreach ($issue_related_articles as $article) : ?>
|
||||
<?php
|
||||
get_template_part('template-parts/dynamiques/article-card', null, array(
|
||||
'ID' => $article->ID,
|
||||
|
||||
));
|
||||
?>
|
||||
<?php endforeach; ?>
|
||||
<!-- <button class="related-articles__show-all">
|
||||
));
|
||||
?>
|
||||
<?php endforeach; ?>
|
||||
<!-- <button class="related-articles__show-all">
|
||||
Tout afficher
|
||||
</button> -->
|
||||
<?php else : ?>
|
||||
<?php else : ?>
|
||||
|
||||
<div class="article-caroussel__slider">
|
||||
<?php if ($issue_related_articles && is_array($issue_related_articles)) : ?>
|
||||
<div class="article-caroussel__slider">
|
||||
<?php if ($issue_related_articles && is_array($issue_related_articles)) : ?>
|
||||
|
||||
|
||||
<div class="swiper dernieres-dynamiques-swiper">
|
||||
<div class="swiper-wrapper">
|
||||
<?php foreach ($issue_related_articles as $article) : ?>
|
||||
<div class="swiper dernieres-dynamiques-swiper">
|
||||
<div class="swiper-wrapper">
|
||||
<?php foreach ($issue_related_articles as $article) : ?>
|
||||
|
||||
<?php get_template_part('template-parts/dynamiques/article-card', null, array(
|
||||
'ID' => $article->ID,
|
||||
'isSwiperSlide' => true,
|
||||
'showCover' => true,
|
||||
)) ?>
|
||||
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<div class="swiper-pagination-fraction"></div>
|
||||
<div class="swiper-pagination"></div>
|
||||
|
||||
<div class="swiper-controls">
|
||||
<div class="swiper-button-prev">
|
||||
<?php
|
||||
$previous_arrow_icon = get_template_directory() . '/resources/img/elements/carhop-slider-previous.svg';
|
||||
if (file_exists($previous_arrow_icon)) {
|
||||
echo file_get_contents($previous_arrow_icon);
|
||||
}
|
||||
?>
|
||||
<?php get_template_part('template-parts/dynamiques/article-card', null, array(
|
||||
'ID' => $article->ID,
|
||||
'isSwiperSlide' => true,
|
||||
'showCover' => true,
|
||||
)) ?>
|
||||
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<div class="swiper-button-next">
|
||||
<?php
|
||||
$next_arrow_icon = get_template_directory() . '/resources/img/elements/carhop-slider-next.svg';
|
||||
if (file_exists($next_arrow_icon)) {
|
||||
echo file_get_contents($next_arrow_icon);
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="swiper-pagination-fraction"></div>
|
||||
<div class="swiper-pagination"></div>
|
||||
|
||||
<div class="swiper-controls">
|
||||
<div class="swiper-button-prev">
|
||||
<?php
|
||||
$previous_arrow_icon = get_template_directory() . '/resources/img/elements/carhop-slider-previous.svg';
|
||||
if (file_exists($previous_arrow_icon)) {
|
||||
echo file_get_contents($previous_arrow_icon);
|
||||
}
|
||||
?>
|
||||
|
||||
</div>
|
||||
<div class="swiper-button-next">
|
||||
<?php
|
||||
$next_arrow_icon = get_template_directory() . '/resources/img/elements/carhop-slider-next.svg';
|
||||
if (file_exists($next_arrow_icon)) {
|
||||
echo file_get_contents($next_arrow_icon);
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user