Browse Source

added ref link to notes

bach 2 years ago
parent
commit
83c3c0443d

+ 11 - 0
src/config/sync/core.entity_form_display.paragraph.note.default.yml

@@ -5,6 +5,7 @@ dependencies:
   config:
     - field.field.paragraph.note.field_note
     - field.field.paragraph.note.field_numero
+    - field.field.paragraph.note.field_text_lien
     - paragraphs.paragraphs_type.note
   module:
     - text
@@ -28,6 +29,16 @@ content:
     third_party_settings: {  }
     type: number
     region: content
+  field_text_lien:
+    weight: 2
+    settings:
+      match_operator: CONTAINS
+      match_limit: 10
+      size: 60
+      placeholder: ''
+    third_party_settings: {  }
+    type: entity_reference_autocomplete
+    region: content
 hidden:
   created: true
   status: true

+ 9 - 0
src/config/sync/core.entity_view_display.paragraph.note.default.yml

@@ -5,6 +5,7 @@ dependencies:
   config:
     - field.field.paragraph.note.field_note
     - field.field.paragraph.note.field_numero
+    - field.field.paragraph.note.field_text_lien
     - paragraphs.paragraphs_type.note
   module:
     - text
@@ -29,5 +30,13 @@ content:
     third_party_settings: {  }
     type: number_integer
     region: content
+  field_text_lien:
+    weight: 2
+    label: above
+    settings:
+      link: true
+    third_party_settings: {  }
+    type: entity_reference_label
+    region: content
 hidden:
   search_api_excerpt: true

+ 31 - 0
src/config/sync/field.field.paragraph.note.field_text_lien.yml

@@ -0,0 +1,31 @@
+uuid: 5504d452-d5bf-480c-aeab-f73bf81d7db9
+langcode: fr
+status: true
+dependencies:
+  config:
+    - field.storage.paragraph.field_text_lien
+    - node.type.texte
+    - node.type.texte_prod
+    - paragraphs.paragraphs_type.note
+id: paragraph.note.field_text_lien
+field_name: field_text_lien
+entity_type: paragraph
+bundle: note
+label: 'Text lien'
+description: ''
+required: false
+translatable: true
+default_value: {  }
+default_value_callback: ''
+settings:
+  handler: 'default:node'
+  handler_settings:
+    target_bundles:
+      texte: texte
+      texte_prod: texte_prod
+    sort:
+      field: _none
+      direction: ASC
+    auto_create: false
+    auto_create_bundle: texte
+field_type: entity_reference

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

@@ -115,6 +115,8 @@ interface NoteInterface {
 type Noteref implements NoteInterface {
   note: String
   numero: Int
+  #
+  liens: [TextInterface]
 }
 
 type Noteprod implements NoteInterface {

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

@@ -584,6 +584,12 @@ class EnFrSchemaExtension extends SdlSchemaExtensionPluginBase {
       ->map('value', $builder->fromParent())
       ->map('path', $builder->fromValue('field_numero.value'))
     );
+
+    $registry->addFieldResolver('Noteprod', 'liens',
+      $builder->produce('entity_reference')
+        ->map('entity', $builder->fromParent())
+        ->map('field', $builder->fromValue('field_text_lien'))
+    );
   }
 
   protected function addNoteProd(ResolverRegistryInterface $registry, ResolverBuilder $builder) {