- {(isEditing || title) &&
-
+ {title &&
+
}
- {(isEditing || description) &&
-
+ {description &&
+
}
- {(isEditing || (isFieldValid('necessary_cookies_name') && isFieldValid('necessary_cookies_description'))) &&
+ {isFieldValid('necessary_cookies_name') && isFieldValid('necessary_cookies_description') &&
<>
-
+
+ {getFieldValue('necessary_cookies_name')}
+
{__('Always enabled', 'planet4-blocks')}
- {isEditing &&
-
- }
-
-
-
- {isEditing &&
-
- }
+
+ {getFieldValue('necessary_cookies_description')}
+
>
}
- {(ENABLE_ANALYTICAL_COOKIES && (isEditing || (isFieldValid('analytical_cookies_name') && isFieldValid('analytical_cookies_description')))) &&
+ {ENABLE_ANALYTICAL_COOKIES && isFieldValid('analytical_cookies_name') && isFieldValid('analytical_cookies_description') &&
<>
-
-
-
- {isEditing &&
-
- }
+
+ {getFieldValue('analytical_cookies_description')}
+
>
}
- {(isEditing || (isFieldValid('all_cookies_name') && isFieldValid('all_cookies_description'))) &&
+ {isFieldValid('all_cookies_name') && isFieldValid('all_cookies_description') &&
<>
-
+
{
updateConsent('ad_storage', !marketingCookiesChecked);
if (marketingCookiesChecked) {
@@ -281,48 +192,15 @@ export const CookiesFrontend = props => {
setConsentCookie(NECESSARY_MARKETING);
}
}}
- name="all_cookies"
- checked={marketingCookiesChecked}
- className="p4-custom-control-input"
- />
-
+
+ {getFieldValue('all_cookies_name')}
+
- {isEditing &&
-
- }
-
-
-
- {isEditing &&
-
- }
+
+ {getFieldValue('all_cookies_description')}
+
>
}
diff --git a/assets/src/blocks/Cookies/CookiesScript.js b/assets/src/blocks/Cookies/CookiesScript.js
index be9bcf7566..ad8b5ecc23 100644
--- a/assets/src/blocks/Cookies/CookiesScript.js
+++ b/assets/src/blocks/Cookies/CookiesScript.js
@@ -1,9 +1,8 @@
import {createRoot} from 'react-dom/client';
-import {BLOCK_NAME} from './CookiesBlock';
import {CookiesFrontend} from './CookiesFrontend';
// Fallback for non migrated content. Remove after migration.
-document.querySelectorAll(`[data-render="${BLOCK_NAME}"]`).forEach(
+document.querySelectorAll('[data-render="planet4-blocks/cookies"]').forEach(
blockNode => {
const attributes = JSON.parse(blockNode.dataset.attributes);
const rootElement = createRoot(blockNode);