supporting anchors
This commit is contained in:
parent
45f02d4758
commit
6795dfaf2e
|
|
@ -8,7 +8,8 @@
|
|||
"icon": "smiley",
|
||||
"description": "Bloc bannière/header de contenu de premier niveau pour les pages de contenu",
|
||||
"supports": {
|
||||
"html": false
|
||||
"html": false,
|
||||
"anchor": true
|
||||
},
|
||||
"textdomain": "homegrade-blocks",
|
||||
"editorScript": "file:./index.js",
|
||||
|
|
@ -52,6 +53,9 @@
|
|||
"imageProportion": {
|
||||
"type": "string",
|
||||
"default": "original"
|
||||
},
|
||||
"anchor": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +1 @@
|
|||
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => 'fb46f6506f140d571d0c');
|
||||
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '585c32b2534a1b8eeb09');
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ function Edit({
|
|||
setAttributes
|
||||
}) {
|
||||
const {
|
||||
anchor,
|
||||
blockCustomTitle,
|
||||
hasCustomTitle,
|
||||
pageHeaderTitle,
|
||||
|
|
@ -136,6 +137,7 @@ function Edit({
|
|||
}
|
||||
});
|
||||
}
|
||||
console.log("attributes", attributes);
|
||||
return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.InspectorControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_5__.PanelBody, {
|
||||
className: "homegrade-blocks-content-page-header__panel-cta",
|
||||
title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Titre du bloc", "homegrade-blocks")
|
||||
|
|
@ -443,7 +445,7 @@ module.exports = window["wp"]["primitives"];
|
|||
\************************/
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"homegrade-content-blocks/content-page-header","version":"0.1.0","title":"Content page header","category":"homegrade-blocks","icon":"smiley","description":"Bloc bannière/header de contenu de premier niveau pour les pages de contenu","supports":{"html":false},"textdomain":"homegrade-blocks","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","render":"file:./render.php","attributes":{"hasCustomTitle":{"type":"boolean","default":false},"blockCustomTitle":{"type":"string"},"pageHeaderTitle":{"type":"string"},"pageHeaderDescription":{"type":"string"},"hasCta":{"type":"boolean","default":false},"cta":{"type":"object"},"hasCustomImage":{"type":"boolean","default":false},"imageUrl":{"type":"string"},"imageAlt":{"type":"string"},"imageId":{"type":"number"},"imageProportion":{"type":"string","default":"original"}}}');
|
||||
module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"homegrade-content-blocks/content-page-header","version":"0.1.0","title":"Content page header","category":"homegrade-blocks","icon":"smiley","description":"Bloc bannière/header de contenu de premier niveau pour les pages de contenu","supports":{"html":false,"anchor":true},"textdomain":"homegrade-blocks","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","render":"file:./render.php","attributes":{"hasCustomTitle":{"type":"boolean","default":false},"blockCustomTitle":{"type":"string"},"pageHeaderTitle":{"type":"string"},"pageHeaderDescription":{"type":"string"},"hasCta":{"type":"boolean","default":false},"cta":{"type":"object"},"hasCustomImage":{"type":"boolean","default":false},"imageUrl":{"type":"string"},"imageAlt":{"type":"string"},"imageId":{"type":"number"},"imageProportion":{"type":"string","default":"original"},"anchor":{"type":"string"}}}');
|
||||
|
||||
/***/ })
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
$pageHeaderTitle = $attributes['pageHeaderTitle'] ?? null;
|
||||
$pageHeaderDescription = $attributes['pageHeaderDescription'] ?? null;
|
||||
$cta = $attributes['cta'] ?? null;
|
||||
|
|
@ -13,7 +12,7 @@ $customTitle = $attributes['blockCustomTitle'] ?? null;
|
|||
?>
|
||||
|
||||
|
||||
<section <?php echo get_block_wrapper_attributes(['class' => 'block-content-page-header']) ?>>
|
||||
<section id="<?php echo esc_html($attributes['anchor']) ?>" <?php echo get_block_wrapper_attributes(['class' => 'block-content-page-header']) ?>>
|
||||
<div class="block-content-page-header__content">
|
||||
<div className="section_titling">
|
||||
<?php if (!$attributes['hasCustomTitle']) : ?>
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@
|
|||
"icon": "smiley",
|
||||
"description": "Bloc bannière/header de contenu de premier niveau pour les pages de contenu",
|
||||
"supports": {
|
||||
"html": false
|
||||
"html": false,
|
||||
"anchor": true
|
||||
},
|
||||
"textdomain": "homegrade-blocks",
|
||||
"editorScript": "file:./index.js",
|
||||
|
|
@ -52,6 +53,9 @@
|
|||
"imageProportion": {
|
||||
"type": "string",
|
||||
"default": "original"
|
||||
},
|
||||
"anchor": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -23,6 +23,7 @@ import { trash } from "@wordpress/icons";
|
|||
|
||||
export default function Edit({ attributes, setAttributes }) {
|
||||
const {
|
||||
anchor,
|
||||
blockCustomTitle,
|
||||
hasCustomTitle,
|
||||
pageHeaderTitle,
|
||||
|
|
@ -108,7 +109,7 @@ export default function Edit({ attributes, setAttributes }) {
|
|||
},
|
||||
});
|
||||
}
|
||||
|
||||
console.log("attributes", attributes);
|
||||
return (
|
||||
<>
|
||||
<InspectorControls>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
$pageHeaderTitle = $attributes['pageHeaderTitle'] ?? null;
|
||||
$pageHeaderDescription = $attributes['pageHeaderDescription'] ?? null;
|
||||
$cta = $attributes['cta'] ?? null;
|
||||
|
|
@ -13,7 +12,7 @@ $customTitle = $attributes['blockCustomTitle'] ?? null;
|
|||
?>
|
||||
|
||||
|
||||
<section <?php echo get_block_wrapper_attributes(['class' => 'block-content-page-header']) ?>>
|
||||
<section id="<?php echo esc_html($attributes['anchor']) ?>" <?php echo get_block_wrapper_attributes(['class' => 'block-content-page-header']) ?>>
|
||||
<div class="block-content-page-header__content">
|
||||
<div className="section_titling">
|
||||
<?php if (!$attributes['hasCustomTitle']) : ?>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user