comment preprocess field

This commit is contained in:
2021-12-10 17:39:07 +01:00
parent 5cf232a542
commit 4d73b2e00b
3 changed files with 16 additions and 16 deletions
+2 -2
View File
@@ -5,6 +5,6 @@ global-css:
global-js: global-js:
js: js:
scripts/main.js: {} scripts/main.js: {}
dependencies: # dependencies:
- core/jquery # - core/jquery
+6 -6
View File
@@ -37,13 +37,13 @@ function eql_preprocess_node(&$variables){
// $variables['elements']['#paragraph']->item_id; // $variables['elements']['#paragraph']->item_id;
// } // }
// la fonction suivante ne sert à rien // la fonction suivante ne sert à rien
function eql_preprocess_field(&$variables) { // function eql_preprocess_field(&$variables) {
$paragraph = &$variables['paragraph']; // $paragraph = &$variables['paragraph'];
$variables['attributes']['class'][] = 'paragraph-type-' . $paragraph->id(); // $variables['attributes']['class'][] = 'paragraph-type-' . $paragraph->id();
$hook_id = $paragraph->get('paragraph-id--')->getString(); // $hook_id = $paragraph->get('paragraph-id--')->getString();
$variables['attributes']['class'][] = 'hook-id-' . $hook_id; // $variables['attributes']['class'][] = 'hook-id-' . $hook_id;
} // }
//might be useful for if-clause: $variables['field_name'] and $variables['field_type'] //might be useful for if-clause: $variables['field_name'] and $variables['field_type']
// if ($paragraph && $paragraph->getEntityTypeId() == 'paragraph' . $paragraph->id() ) { // if ($paragraph && $paragraph->getEntityTypeId() == 'paragraph' . $paragraph->id() ) {
//whatever logic you need goes here, e.g. something like //whatever logic you need goes here, e.g. something like
+8 -8
View File
@@ -35,14 +35,14 @@ function toggleFaq(event) {
// fonction pour attribuer la class du parents // fonction pour attribuer la class du parents
var fields = document.getElementsByClassName("field--name-field-titre"); // var fields = document.getElementsByClassName("field--name-field-titre");
var paragraphs = document.getElementsByClassName("paragraph--type--texte"); // var paragraphs = document.getElementsByClassName("paragraph--type--texte");
for (let i = 0; i < fields.length; i++) { // for (let i = 0; i < fields.length; i++) {
const field = fields[i] // const field = fields[i]
} // }
function giveIdParent(){ // function giveIdParent(){
document.field.classList="paragraphs"; // document.field.classList="paragraphs";
} // }
// Function mouseOut () // Function mouseOut ()
// { // {