Explorar o código

created burger menu field in static CT, created burgerstatics gql query

bach %!s(int64=3) %!d(string=hai) anos
pai
achega
162ff36cff

+ 24 - 2
src/config/sync/core.entity_form_display.node.static.default.yml

@@ -5,6 +5,7 @@ dependencies:
   config:
     - field.field.node.static.body
     - field.field.node.static.field_fichier
+    - field.field.node.static.field_menu_burger
     - field.field.node.static.field_notes
     - field.field.node.static.field_poid
     - node.type.static
@@ -60,7 +61,7 @@ third_party_settings:
     group_sidebar:
       children:
         - status
-        - field_poid
+        - group_menu_burger
       parent_name: ''
       weight: 20
       format_type: details_sidebar
@@ -73,6 +74,20 @@ third_party_settings:
         required_fields: true
         weight: 0
       label: Sidebar
+    group_menu_burger:
+      children:
+        - field_menu_burger
+        - field_poid
+      parent_name: group_sidebar
+      weight: 121
+      format_type: fieldset
+      region: hidden
+      format_settings:
+        id: ''
+        classes: ''
+        description: ''
+        required_fields: true
+      label: 'Menu Burger'
 id: node.static.default
 targetEntityType: node
 bundle: static
@@ -95,6 +110,13 @@ content:
     third_party_settings: {  }
     type: file_generic
     region: content
+  field_menu_burger:
+    weight: 124
+    settings:
+      display_label: true
+    third_party_settings: {  }
+    type: boolean_checkbox
+    region: content
   field_notes:
     weight: 121
     settings:
@@ -108,7 +130,7 @@ content:
     type: entity_reference_paragraphs
     region: content
   field_poid:
-    weight: 123
+    weight: 125
     settings:
       placeholder: ''
     third_party_settings: {  }

+ 3 - 9
src/config/sync/core.entity_view_display.node.static.default.yml

@@ -5,6 +5,7 @@ dependencies:
   config:
     - field.field.node.static.body
     - field.field.node.static.field_fichier
+    - field.field.node.static.field_menu_burger
     - field.field.node.static.field_notes
     - field.field.node.static.field_poid
     - node.type.static
@@ -44,20 +45,13 @@ content:
     third_party_settings: {  }
     type: entity_reference_revisions_entity_view
     region: content
-  field_poid:
-    weight: 4
-    label: above
-    settings:
-      thousand_separator: ''
-      prefix_suffix: true
-    third_party_settings: {  }
-    type: number_integer
-    region: content
   links:
     weight: 1
     region: content
     settings: {  }
     third_party_settings: {  }
 hidden:
+  field_menu_burger: true
+  field_poid: true
   langcode: true
   search_api_excerpt: true

+ 23 - 0
src/config/sync/field.field.node.static.field_menu_burger.yml

@@ -0,0 +1,23 @@
+uuid: 9d1ab5a8-8a61-4397-8545-69918bf028a5
+langcode: fr
+status: true
+dependencies:
+  config:
+    - field.storage.node.field_menu_burger
+    - node.type.static
+id: node.static.field_menu_burger
+field_name: field_menu_burger
+entity_type: node
+bundle: static
+label: 'Afficher dans le menu burger'
+description: ''
+required: false
+translatable: false
+default_value:
+  -
+    value: 0
+default_value_callback: ''
+settings:
+  on_label: Activé
+  off_label: Désactivé
+field_type: boolean

+ 18 - 0
src/config/sync/field.storage.node.field_menu_burger.yml

@@ -0,0 +1,18 @@
+uuid: 762f264f-66e7-4d95-9861-70f6acbaf79f
+langcode: fr
+status: true
+dependencies:
+  module:
+    - node
+id: node.field_menu_burger
+field_name: field_menu_burger
+entity_type: node
+type: boolean
+settings: {  }
+module: core
+locked: false
+cardinality: 1
+translatable: true
+indexes: {  }
+persist_with_no_fields: false
+custom_storage: false

+ 4 - 0
src/web/modules/custom/enfrancais_graphql/graphql/enfr_extension.extension.graphqls

@@ -62,6 +62,10 @@ extend type Query {
   allstatics: [Static]
 }
 
+extend type Query {
+  burgerstatics: [Static]
+}
+
 extend type Query {
   statics(ids: [Int]): [Static]
 }

+ 29 - 12
src/web/modules/custom/enfrancais_graphql/src/Plugin/GraphQL/SchemaExtension/EnFrSchemaExtension.php

@@ -741,18 +741,35 @@ class EnFrSchemaExtension extends SdlSchemaExtensionPluginBase {
 
     $registry->addFieldResolver('Query', 'allstatics',
       $builder->compose(
-          $builder->callback(function($parent, $arg){
-            $entity_storage = \Drupal::entityTypeManager()->getStorage('node');
-            $query = $entity_storage->getQuery()
-              ->condition('type', ['static'], 'IN')
-              ->accessCheck(TRUE);
-            $results = $query->execute();
-            return $results;
-          }),
-          $builder->produce('entity_load_multiple')
-          ->map('type', $builder->fromValue('node'))
-          ->map('ids', $builder->fromParent())
-        )
+        $builder->callback(function($parent, $arg){
+          $entity_storage = \Drupal::entityTypeManager()->getStorage('node');
+          $query = $entity_storage->getQuery()
+            ->condition('type', ['static'], 'IN')
+            ->accessCheck(TRUE);
+          $results = $query->execute();
+          return $results;
+        }),
+        $builder->produce('entity_load_multiple')
+        ->map('type', $builder->fromValue('node'))
+        ->map('ids', $builder->fromParent())
+      )
+    );
+
+    $registry->addFieldResolver('Query', 'burgerstatics',
+      $builder->compose(
+        $builder->callback(function($parent, $arg){
+          $entity_storage = \Drupal::entityTypeManager()->getStorage('node');
+          $query = $entity_storage->getQuery()
+            ->condition('type', ['static'], 'IN')
+            ->condition('field_menu_burger', true)
+            ->accessCheck(TRUE);
+          $results = $query->execute();
+          return $results;
+        }),
+        $builder->produce('entity_load_multiple')
+        ->map('type', $builder->fromValue('node'))
+        ->map('ids', $builder->fromParent())
+      )
     );
 
     $registry->addFieldResolver('Query', 'statics',