Browse Source

field_images on creation #1270

bach 2 years ago
parent
commit
3808a29e2f

+ 26 - 0
src/config/sync/core.entity_form_display.node.creation.default.yml

@@ -6,13 +6,16 @@ dependencies:
     - field.field.node.creation.body
     - field.field.node.creation.field_auteurs
     - field.field.node.creation.field_date
+    - field.field.node.creation.field_images
     - field.field.node.creation.field_oeuvre
     - field.field.node.creation.field_rebonds
     - field.field.node.creation.field_texte_de_depart
+    - image.style.thumbnail
     - node.type.creation
   module:
     - datetime
     - field_group
+    - image
     - link
     - text
 third_party_settings:
@@ -51,6 +54,7 @@ third_party_settings:
     group_tabs:
       children:
         - group_principal
+        - group_images
         - group_lien
       parent_name: ''
       weight: 20
@@ -78,6 +82,20 @@ third_party_settings:
         formatter: open
         required_fields: true
       label: Principal
+    group_images:
+      children:
+        - field_images
+      parent_name: group_tabs
+      weight: 20
+      format_type: tab
+      region: content
+      format_settings:
+        id: ''
+        classes: ''
+        description: ''
+        formatter: closed
+        required_fields: true
+      label: Images
 id: node.creation.default
 targetEntityType: node
 bundle: creation
@@ -109,6 +127,14 @@ content:
     third_party_settings: {  }
     type: datetime_default
     region: content
+  field_images:
+    weight: 31
+    settings:
+      progress_indicator: throbber
+      preview_image_style: thumbnail
+    third_party_settings: {  }
+    type: image_image
+    region: content
   field_oeuvre:
     weight: 1
     settings:

+ 11 - 0
src/config/sync/core.entity_view_display.node.creation.default.yml

@@ -6,12 +6,14 @@ dependencies:
     - field.field.node.creation.body
     - field.field.node.creation.field_auteurs
     - field.field.node.creation.field_date
+    - field.field.node.creation.field_images
     - field.field.node.creation.field_oeuvre
     - field.field.node.creation.field_rebonds
     - field.field.node.creation.field_texte_de_depart
     - node.type.creation
   module:
     - datetime
+    - image
     - link
     - text
     - user
@@ -44,6 +46,15 @@ content:
     third_party_settings: {  }
     type: datetime_default
     region: content
+  field_images:
+    weight: 108
+    label: above
+    settings:
+      image_style: ''
+      image_link: ''
+    third_party_settings: {  }
+    type: image
+    region: content
   field_oeuvre:
     weight: 103
     label: above

+ 2 - 0
src/config/sync/core.entity_view_display.node.creation.teaser.yml

@@ -7,6 +7,7 @@ dependencies:
     - field.field.node.creation.body
     - field.field.node.creation.field_auteurs
     - field.field.node.creation.field_date
+    - field.field.node.creation.field_images
     - field.field.node.creation.field_oeuvre
     - field.field.node.creation.field_rebonds
     - field.field.node.creation.field_texte_de_depart
@@ -35,6 +36,7 @@ content:
 hidden:
   field_auteurs: true
   field_date: true
+  field_images: true
   field_oeuvre: true
   field_rebonds: true
   field_texte_de_depart: true

+ 45 - 0
src/config/sync/field.field.node.creation.field_images.yml

@@ -0,0 +1,45 @@
+uuid: ed77ee8b-8825-445f-ad74-5d5ddcd5a60e
+langcode: fr
+status: true
+dependencies:
+  config:
+    - field.storage.node.field_images
+    - node.type.creation
+  module:
+    - content_translation
+    - image
+third_party_settings:
+  content_translation:
+    translation_sync:
+      alt: alt
+      file: '0'
+      title: '0'
+id: node.creation.field_images
+field_name: field_images
+entity_type: node
+bundle: creation
+label: Images
+description: ''
+required: false
+translatable: true
+default_value: {  }
+default_value_callback: ''
+settings:
+  file_directory: '[date:custom:Y]-[date:custom:m]'
+  file_extensions: 'png gif jpg jpeg'
+  max_filesize: ''
+  max_resolution: ''
+  min_resolution: ''
+  alt_field: true
+  alt_field_required: false
+  title_field: false
+  title_field_required: false
+  default_image:
+    uuid: ''
+    alt: ''
+    title: ''
+    width: null
+    height: null
+  handler: 'default:file'
+  handler_settings: {  }
+field_type: image

+ 1 - 0
src/web/modules/custom/enfrancais_graphql/graphql/enfr_extension.base.graphqls

@@ -89,6 +89,7 @@ type Creation implements NodeInterface & MapItemInterface {
   date: Date # field_date
   rebonds: [Creation] # field_rebonds
   texte_de_depart: [Textref] # field_texte_de_depart
+  images: [Image]
 }
 
 type Static implements NodeInterface {

+ 6 - 0
src/web/modules/custom/enfrancais_graphql/src/Plugin/GraphQL/SchemaExtension/EnFrSchemaExtension.php

@@ -650,6 +650,12 @@ class EnFrSchemaExtension extends SdlSchemaExtensionPluginBase {
           ->map('entity', $builder->fromParent())
     ));
 
+    $registry->addFieldResolver('Creation', 'images',
+      $builder->produce('entity_reference')
+        ->map('entity', $builder->fromParent())
+        ->map('field', $builder->fromValue('field_images'))
+      );
+
     $registry->addFieldResolver('Creation', 'auteurs',
       $builder->produce('entity_reference')
         ->map('entity', $builder->fromParent())