handling admin language from cookies
This commit is contained in:
parent
3854f07a4f
commit
90ff908fc8
|
|
@ -1 +1 @@
|
||||||
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n', 'wp-notices'), 'version' => '6d996a67717d11da59bc');
|
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n', 'wp-notices'), 'version' => '9351c7eea85fb0780aa2');
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,7 @@ __webpack_require__.r(__webpack_exports__);
|
||||||
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components");
|
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components");
|
||||||
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__);
|
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__);
|
||||||
/* harmony import */ var _img_chevron_down_svg__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./img/chevron_down.svg */ "./src/img/chevron_down.svg");
|
/* harmony import */ var _img_chevron_down_svg__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./img/chevron_down.svg */ "./src/img/chevron_down.svg");
|
||||||
|
/* harmony import */ var _utils_getAdminLanguageFromCookies_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../../utils/getAdminLanguageFromCookies.js */ "../../utils/getAdminLanguageFromCookies.js");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -195,6 +196,8 @@ function Edit({
|
||||||
(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
|
(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
|
||||||
passIndexToChildren();
|
passIndexToChildren();
|
||||||
}, [currentBlockDatas]);
|
}, [currentBlockDatas]);
|
||||||
|
const currentLang = (0,_utils_getAdminLanguageFromCookies_js__WEBPACK_IMPORTED_MODULE_10__["default"])("wp-wpml_current_language");
|
||||||
|
const localVersionTextDescription = currentLang === "nl" ? "Tekstversie van de illustratie" : "Version texte des indications de l'illustration";
|
||||||
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_7__.InspectorControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.PanelBody, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.Button, {
|
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_7__.InspectorControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.PanelBody, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.Button, {
|
||||||
variant: "primary",
|
variant: "primary",
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
|
|
@ -212,7 +215,7 @@ function Edit({
|
||||||
}), renderedFocusPointBullets), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("button", {
|
}), renderedFocusPointBullets), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("button", {
|
||||||
className: "homegrade-blocks-focused-thematique__figcaption-toggle",
|
className: "homegrade-blocks-focused-thematique__figcaption-toggle",
|
||||||
"aria-expanded": "false"
|
"aria-expanded": "false"
|
||||||
}, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)("Version texte des indications de l'illustration", "homegrade-blocks__texte-fonctionnel"), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", {
|
}, localVersionTextDescription, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", {
|
||||||
src: _img_chevron_down_svg__WEBPACK_IMPORTED_MODULE_9__["default"],
|
src: _img_chevron_down_svg__WEBPACK_IMPORTED_MODULE_9__["default"],
|
||||||
alt: ""
|
alt: ""
|
||||||
})), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("figcaption", {
|
})), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("figcaption", {
|
||||||
|
|
@ -475,6 +478,7 @@ __webpack_require__.r(__webpack_exports__);
|
||||||
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
|
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
|
||||||
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__);
|
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__);
|
||||||
/* harmony import */ var _img_chevron_down_svg__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./img/chevron_down.svg */ "./src/img/chevron_down.svg");
|
/* harmony import */ var _img_chevron_down_svg__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./img/chevron_down.svg */ "./src/img/chevron_down.svg");
|
||||||
|
/* harmony import */ var _utils_getAdminLanguageFromCookies_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../utils/getAdminLanguageFromCookies.js */ "../../utils/getAdminLanguageFromCookies.js");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -504,6 +508,8 @@ function save({
|
||||||
className: "homegrade-blocks-focus-point-bullet__index"
|
className: "homegrade-blocks-focus-point-bullet__index"
|
||||||
}, index + 1));
|
}, index + 1));
|
||||||
});
|
});
|
||||||
|
const currentLang = (0,_utils_getAdminLanguageFromCookies_js__WEBPACK_IMPORTED_MODULE_4__["default"])("wp-wpml_current_language");
|
||||||
|
const localVersionTextDescription = currentLang === "nl" ? "Tekstversie van de illustratie" : "Version texte des indications de l'illustration";
|
||||||
return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("section", {
|
return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("section", {
|
||||||
..._wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps.save({
|
..._wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps.save({
|
||||||
className: `homegrade-blocks-focused-thematique`
|
className: `homegrade-blocks-focused-thematique`
|
||||||
|
|
@ -517,7 +523,7 @@ function save({
|
||||||
}), renderedFocusPointBullets), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("button", {
|
}), renderedFocusPointBullets), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("button", {
|
||||||
className: "homegrade-blocks-focused-thematique__figcaption-toggle",
|
className: "homegrade-blocks-focused-thematique__figcaption-toggle",
|
||||||
"aria-expanded": "false"
|
"aria-expanded": "false"
|
||||||
}, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)("Version texte des indications de l'illustration", "homegrade-blocks__texte-fonctionnel"), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", {
|
}, localVersionTextDescription, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", {
|
||||||
src: _img_chevron_down_svg__WEBPACK_IMPORTED_MODULE_3__["default"],
|
src: _img_chevron_down_svg__WEBPACK_IMPORTED_MODULE_3__["default"],
|
||||||
alt: ""
|
alt: ""
|
||||||
})), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("figcaption", {
|
})), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("figcaption", {
|
||||||
|
|
@ -527,6 +533,35 @@ function save({
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ "../../utils/getAdminLanguageFromCookies.js":
|
||||||
|
/*!**************************************************!*\
|
||||||
|
!*** ../../utils/getAdminLanguageFromCookies.js ***!
|
||||||
|
\**************************************************/
|
||||||
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||||
|
|
||||||
|
__webpack_require__.r(__webpack_exports__);
|
||||||
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
|
/* harmony export */ "default": () => (/* binding */ getAdminLanguageFromCookies)
|
||||||
|
/* harmony export */ });
|
||||||
|
function getAdminLanguageFromCookies(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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
/***/ "./src/editor.scss":
|
/***/ "./src/editor.scss":
|
||||||
/*!*************************!*\
|
/*!*************************!*\
|
||||||
!*** ./src/editor.scss ***!
|
!*** ./src/editor.scss ***!
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -11,8 +11,9 @@ import { useBlockProps, InspectorControls } from "@wordpress/block-editor";
|
||||||
import { withNotices, Button, PanelBody } from "@wordpress/components";
|
import { withNotices, Button, PanelBody } from "@wordpress/components";
|
||||||
import { InnerBlocks } from "@wordpress/block-editor";
|
import { InnerBlocks } from "@wordpress/block-editor";
|
||||||
|
|
||||||
import { ChevronDown } from "lucide-react";
|
|
||||||
import chevronDown from "./img/chevron_down.svg";
|
import chevronDown from "./img/chevron_down.svg";
|
||||||
|
import getAdminLanguageFromCookies from "../../../utils/getAdminLanguageFromCookies.js";
|
||||||
|
|
||||||
function Edit({
|
function Edit({
|
||||||
attributes,
|
attributes,
|
||||||
setAttributes,
|
setAttributes,
|
||||||
|
|
@ -175,6 +176,12 @@ function Edit({
|
||||||
passIndexToChildren();
|
passIndexToChildren();
|
||||||
}, [currentBlockDatas]);
|
}, [currentBlockDatas]);
|
||||||
|
|
||||||
|
const currentLang = getAdminLanguageFromCookies("wp-wpml_current_language");
|
||||||
|
const localVersionTextDescription =
|
||||||
|
currentLang === "nl"
|
||||||
|
? "Tekstversie van de illustratie"
|
||||||
|
: "Version texte des indications de l'illustration";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<InspectorControls>
|
<InspectorControls>
|
||||||
|
|
@ -206,10 +213,7 @@ function Edit({
|
||||||
className="homegrade-blocks-focused-thematique__figcaption-toggle"
|
className="homegrade-blocks-focused-thematique__figcaption-toggle"
|
||||||
aria-expanded="false"
|
aria-expanded="false"
|
||||||
>
|
>
|
||||||
{__(
|
{localVersionTextDescription}
|
||||||
"Version texte des indications de l'illustration",
|
|
||||||
"homegrade-blocks"
|
|
||||||
)}
|
|
||||||
{/* <ChevronDown /> */}
|
{/* <ChevronDown /> */}
|
||||||
<img src={chevronDown} alt="" />
|
<img src={chevronDown} alt="" />
|
||||||
</button>
|
</button>
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,10 @@
|
||||||
import {
|
import { useBlockProps } from "@wordpress/block-editor";
|
||||||
useBlockProps,
|
|
||||||
MediaPlaceholder,
|
|
||||||
RichText,
|
|
||||||
BlockControls,
|
|
||||||
MediaReplaceFlow,
|
|
||||||
} from "@wordpress/block-editor";
|
|
||||||
import { __ } from "@wordpress/i18n";
|
import { __ } from "@wordpress/i18n";
|
||||||
|
|
||||||
import chevronDown from "./img/chevron_down.svg";
|
import chevronDown from "./img/chevron_down.svg";
|
||||||
import { Camera } from "lucide-react";
|
|
||||||
|
|
||||||
import { InnerBlocks } from "@wordpress/block-editor";
|
import { InnerBlocks } from "@wordpress/block-editor";
|
||||||
|
import getAdminLanguageFromCookies from "../../../utils/getAdminLanguageFromCookies.js";
|
||||||
|
|
||||||
export default function save({ attributes }) {
|
export default function save({ attributes }) {
|
||||||
const { coverUrl, coverId, coverAlt, focusBullets } = attributes;
|
const { coverUrl, coverId, coverAlt, focusBullets } = attributes;
|
||||||
|
|
@ -32,6 +26,11 @@ export default function save({ attributes }) {
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
const currentLang = getAdminLanguageFromCookies("wp-wpml_current_language");
|
||||||
|
const localVersionTextDescription =
|
||||||
|
currentLang === "nl"
|
||||||
|
? "Tekstversie van de illustratie"
|
||||||
|
: "Version texte des indications de l'illustration";
|
||||||
return (
|
return (
|
||||||
<section
|
<section
|
||||||
{...useBlockProps.save({
|
{...useBlockProps.save({
|
||||||
|
|
@ -52,10 +51,7 @@ export default function save({ attributes }) {
|
||||||
className="homegrade-blocks-focused-thematique__figcaption-toggle"
|
className="homegrade-blocks-focused-thematique__figcaption-toggle"
|
||||||
aria-expanded="false"
|
aria-expanded="false"
|
||||||
>
|
>
|
||||||
{__(
|
{localVersionTextDescription}
|
||||||
"Version texte des indications de l'illustration",
|
|
||||||
"homegrade-blocks__texte-fonctionnel"
|
|
||||||
)}
|
|
||||||
{/* <ChevronDown /> */}
|
{/* <ChevronDown /> */}
|
||||||
<img src={chevronDown} alt="" />
|
<img src={chevronDown} alt="" />
|
||||||
</button>
|
</button>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user