60 lines
1.7 KiB
JavaScript
60 lines
1.7 KiB
JavaScript
import { __ } from "@wordpress/i18n";
|
|
import "./editor.scss";
|
|
import keyIcon from "./img/icon_feather_key.svg";
|
|
import chainIcon from "./img/icon_block_chain.svg";
|
|
import houseIcon from "./img/icon_house.svg";
|
|
import bulbIcon from "./img/icon_bulb.svg";
|
|
import { useBlockProps, InnerBlocks } from "@wordpress/block-editor";
|
|
import { useSelect } from "@wordpress/data";
|
|
import { ToolbarButton, ToggleControl, PanelBody } from "@wordpress/components";
|
|
|
|
export default function Edit({ attributes, setAttributes }) {
|
|
function getAdminLanguageFromCookie(c_name) {
|
|
var c_value = document.cookie,
|
|
c_start = c_value.indexOf(" " + c_name + "=");
|
|
if (c_start == -1) c_start = c_value.indexOf(c_name + "=");
|
|
if (c_start == -1) {
|
|
c_value = null;
|
|
} else {
|
|
c_start = c_value.indexOf("=", c_start) + 1;
|
|
var c_end = c_value.indexOf(";", c_start);
|
|
if (c_end == -1) {
|
|
c_end = c_value.length;
|
|
}
|
|
c_value = unescape(c_value.substring(c_start, c_end));
|
|
}
|
|
return c_value;
|
|
}
|
|
const currentLang = getAdminLanguageFromCookie("wp-wpml_current_language");
|
|
const localBlockName =
|
|
currentLang === "fr" ? "Pour aller plus loin" : "Om verder te gaan";
|
|
return (
|
|
<>
|
|
<section
|
|
id="aller-plus-loin"
|
|
{...useBlockProps({ className: `homegrade-blocks-plus-loin` })}
|
|
>
|
|
{localBlockName && (
|
|
<h2 className="homegrade-blocks-plus-loin__block-title">
|
|
{localBlockName}
|
|
</h2>
|
|
)}
|
|
|
|
<InnerBlocks
|
|
allowedBlocks={[
|
|
"core/paragraph",
|
|
"homegrade-blocks/content-heading",
|
|
"core/list",
|
|
"core/buttons",
|
|
"core/button",
|
|
"core/colums",
|
|
"core/colum",
|
|
"homegrade-content-blocks/content-heading",
|
|
]}
|
|
template={[["core/paragraph"]]}
|
|
/>
|
|
</section>
|
|
</>
|
|
);
|
|
}
|