Prechádzať zdrojové kódy

added fichiers (pdf) to creations

bach 3 rokov pred
rodič
commit
0c91c34984

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

@@ -6,6 +6,7 @@ dependencies:
     - field.field.node.creation.body
     - field.field.node.creation.field_auteurs
     - field.field.node.creation.field_date
+    - field.field.node.creation.field_fichiers
     - field.field.node.creation.field_images
     - field.field.node.creation.field_oeuvre
     - field.field.node.creation.field_rebonds
@@ -15,6 +16,7 @@ dependencies:
   module:
     - datetime
     - field_group
+    - file
     - image
     - link
     - text
@@ -56,6 +58,7 @@ third_party_settings:
         - group_principal
         - group_images
         - group_lien
+        - group_fichiers
       parent_name: ''
       weight: 20
       format_type: tabs
@@ -96,6 +99,20 @@ third_party_settings:
         formatter: closed
         required_fields: true
       label: Images
+    group_fichiers:
+      children:
+        - field_fichiers
+      parent_name: group_tabs
+      weight: 22
+      format_type: tab
+      region: content
+      format_settings:
+        id: ''
+        classes: ''
+        description: ''
+        formatter: closed
+        required_fields: true
+      label: Fichiers
 id: node.creation.default
 targetEntityType: node
 bundle: creation
@@ -127,6 +144,13 @@ content:
     third_party_settings: {  }
     type: datetime_default
     region: content
+  field_fichiers:
+    weight: 32
+    settings:
+      progress_indicator: throbber
+    third_party_settings: {  }
+    type: file_generic
+    region: content
   field_images:
     weight: 31
     settings:

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

@@ -6,6 +6,7 @@ dependencies:
     - field.field.node.creation.body
     - field.field.node.creation.field_auteurs
     - field.field.node.creation.field_date
+    - field.field.node.creation.field_fichiers
     - field.field.node.creation.field_images
     - field.field.node.creation.field_oeuvre
     - field.field.node.creation.field_rebonds
@@ -13,6 +14,7 @@ dependencies:
     - node.type.creation
   module:
     - datetime
+    - file
     - image
     - link
     - text
@@ -46,6 +48,14 @@ content:
     third_party_settings: {  }
     type: datetime_default
     region: content
+  field_fichiers:
+    weight: 109
+    label: above
+    settings:
+      use_description_as_link_text: true
+    third_party_settings: {  }
+    type: file_default
+    region: content
   field_images:
     weight: 108
     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_fichiers
     - field.field.node.creation.field_images
     - field.field.node.creation.field_oeuvre
     - field.field.node.creation.field_rebonds
@@ -36,6 +37,7 @@ content:
 hidden:
   field_auteurs: true
   field_date: true
+  field_fichiers: true
   field_images: true
   field_oeuvre: true
   field_rebonds: true

+ 27 - 0
src/config/sync/field.field.node.creation.field_fichiers.yml

@@ -0,0 +1,27 @@
+uuid: b37b6ba1-6200-45ce-b897-95731c079c2e
+langcode: fr
+status: true
+dependencies:
+  config:
+    - field.storage.node.field_fichiers
+    - node.type.creation
+  module:
+    - file
+id: node.creation.field_fichiers
+field_name: field_fichiers
+entity_type: node
+bundle: creation
+label: Fichiers
+description: ''
+required: false
+translatable: false
+default_value: {  }
+default_value_callback: ''
+settings:
+  file_directory: '[date:custom:Y]-[date:custom:m]'
+  file_extensions: pdf
+  max_filesize: ''
+  description_field: true
+  handler: 'default:file'
+  handler_settings: {  }
+field_type: file

+ 23 - 0
src/config/sync/field.storage.node.field_fichiers.yml

@@ -0,0 +1,23 @@
+uuid: 44b553c0-301d-48b5-8af6-a302a3b967ff
+langcode: fr
+status: true
+dependencies:
+  module:
+    - file
+    - node
+id: node.field_fichiers
+field_name: field_fichiers
+entity_type: node
+type: file
+settings:
+  display_field: true
+  display_default: true
+  uri_scheme: public
+  target_type: file
+module: file
+locked: false
+cardinality: -1
+translatable: true
+indexes: {  }
+persist_with_no_fields: false
+custom_storage: false

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

@@ -90,6 +90,7 @@ type Creation implements NodeInterface & MapItemInterface {
   rebonds: [Creation] # field_rebonds
   texte_de_depart: [Textref] # field_texte_de_depart
   images: [Image]
+  fichiers: [File]
 }
 
 type Static implements NodeInterface {

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

@@ -730,6 +730,12 @@ class EnFrSchemaExtension extends SdlSchemaExtensionPluginBase {
         ->map('value', $builder->fromParent())
         ->map('path', $builder->fromValue('field_date'))
       );
+
+    $registry->addFieldResolver('Creation', 'fichiers',
+      $builder->produce('entity_reference')
+        ->map('entity', $builder->fromParent())
+        ->map('field', $builder->fromValue('field_fichiers'))
+      );
   }