Browse Source

batch of improvement from quantin's feedback

Bachir Soussi Chiadmi 4 years ago
parent
commit
983f99876c

+ 1 - 1
config/sync/core.base_field_override.node.materiau.title.yml

@@ -8,7 +8,7 @@ id: node.materiau.title
 field_name: title
 entity_type: node
 bundle: materiau
-label: Title
+label: Name
 description: ''
 required: true
 translatable: false

+ 1 - 1
config/sync/field.field.node.materiau.field_famille.yml

@@ -11,7 +11,7 @@ id: node.materiau.field_famille
 field_name: field_famille
 entity_type: node
 bundle: materiau
-label: Famille
+label: Family
 description: ''
 required: true
 translatable: false

+ 5 - 7
config/sync/field.field.node.materiau.field_linked_materials.yml

@@ -16,12 +16,10 @@ translatable: false
 default_value: {  }
 default_value_callback: ''
 settings:
-  handler: 'default:node'
+  handler: views
   handler_settings:
-    target_bundles:
-      materiau: materiau
-    sort:
-      field: _none
-    auto_create: false
-    auto_create_bundle: ''
+    view:
+      view_name: entity_references
+      display_name: entity_reference_1
+      arguments: {  }
 field_type: entity_reference

+ 1 - 1
config/sync/image.style.card_medium.yml

@@ -3,7 +3,7 @@ langcode: en
 status: true
 dependencies: {  }
 name: card_medium
-label: card-medium
+label: 'card-medium (210x295)'
 effects:
   34e936a0-1fee-4327-9553-b4f48bde14e6:
     uuid: 34e936a0-1fee-4327-9553-b4f48bde14e6

+ 15 - 0
config/sync/image.style.card_small.yml

@@ -0,0 +1,15 @@
+uuid: 7b14e7ed-c822-49e2-9dfe-2bd07f535cb0
+langcode: en
+status: true
+dependencies: {  }
+name: card_small
+label: 'card-small (100x140)'
+effects:
+  b36b5a37-6235-40e1-aef1-54fe4244ace6:
+    uuid: b36b5a37-6235-40e1-aef1-54fe4244ace6
+    id: image_scale_and_crop
+    weight: 1
+    data:
+      width: 100
+      height: 140
+      anchor: center-center

+ 1 - 1
config/sync/language.content_settings.node.materiau.yml

@@ -15,4 +15,4 @@ id: node.materiau
 target_entity_type_id: node
 target_bundle: materiau
 default_langcode: site_default
-language_alterable: true
+language_alterable: false

+ 1 - 1
config/sync/node.type.materiau.yml

@@ -13,5 +13,5 @@ type: materiau
 description: ''
 help: ''
 new_revision: false
-preview_mode: 1
+preview_mode: 0
 display_submitted: false

+ 5 - 1
config/sync/search_api.index.database.yml

@@ -7,9 +7,10 @@ dependencies:
     - node
     - taxonomy
     - search_api
+    - materio_sapi
   config:
-    - field.storage.node.body
     - field.storage.node.field_famille
+    - field.storage.node.body
     - field.storage.node.field_tags
     - field.storage.taxonomy_term.field_synonyms
     - field.storage.node.field_thesaurus
@@ -209,9 +210,12 @@ processor_settings:
       - processed
       - tag_name
       - tag_synonyms
+      - tag_tid
       - thesaurus_name
       - thesaurus_synonyms
+      - thesaurus_tid
       - title
+      - uuid
     replacement: '|9999999998|'
     weights:
       postprocess_query: 0

+ 129 - 41
config/sync/views.view.admin_nodes.yml

@@ -3,6 +3,7 @@ langcode: en
 status: true
 dependencies:
   config:
+    - field.storage.node.field_attachments
     - field.storage.node.field_distributor
     - field.storage.node.field_linked_articles
     - field.storage.node.field_linked_materials
@@ -16,6 +17,7 @@ dependencies:
     - field.storage.node.field_thesaurus
     - field.storage.node.field_visuel
     - field.storage.node.field_workflow
+    - image.style.card_small
     - image.style.medium
     - node.type.article
     - node.type.materiau
@@ -27,6 +29,7 @@ dependencies:
   module:
     - computed_field
     - content_lock
+    - file
     - image
     - materio_samples
     - node
@@ -287,7 +290,7 @@ display:
           batch_size: 10
           form_step: true
           buttons: false
-          clear_on_exposed: false
+          clear_on_exposed: true
           action_title: Action
           selected_actions:
             'entity:break_lock:node': 'entity:break_lock:node'
@@ -300,9 +303,11 @@ display:
             node_make_unsticky_action: 0
             node_save_action: node_save_action
             node_make_sticky_action: 0
-            views_bulk_edit: 0
+            simplenews_send_action: 0
+            simplenews_stop_action: 0
+            views_bulk_edit: views_bulk_edit
             views_bulk_operations_delete_entity: views_bulk_operations_delete_entity
-            workflow_node_given_state_action: 0
+            workflow_node_given_state_action: workflow_node_given_state_action
             workflow_node_next_state_action: 0
             pathauto_update_alias: pathauto_update_alias
             'entity:delete_action:node': 0
@@ -314,8 +319,13 @@ display:
               label_override: ''
             node_save_action:
               label_override: ''
+            views_bulk_edit:
+              label_override: ''
+              get_bundles_from_results: 1
             views_bulk_operations_delete_entity:
               label_override: ''
+            workflow_node_given_state_action:
+              label_override: ''
             pathauto_update_alias:
               label_override: ''
           plugin_id: views_bulk_operations_bulk_form
@@ -2308,7 +2318,7 @@ display:
           batch_size: 10
           form_step: true
           buttons: false
-          clear_on_exposed: false
+          clear_on_exposed: true
           action_title: Action
           selected_actions:
             'entity:break_lock:node': 'entity:break_lock:node'
@@ -2321,9 +2331,11 @@ display:
             node_make_unsticky_action: 0
             node_save_action: node_save_action
             node_make_sticky_action: 0
-            views_bulk_edit: 0
+            simplenews_send_action: 0
+            simplenews_stop_action: 0
+            views_bulk_edit: views_bulk_edit
             views_bulk_operations_delete_entity: views_bulk_operations_delete_entity
-            workflow_node_given_state_action: 0
+            workflow_node_given_state_action: workflow_node_given_state_action
             workflow_node_next_state_action: 0
             pathauto_update_alias: pathauto_update_alias
             'entity:delete_action:node': 0
@@ -2335,8 +2347,13 @@ display:
               label_override: ''
             node_save_action:
               label_override: ''
+            views_bulk_edit:
+              label_override: ''
+              get_bundles_from_results: 1
             views_bulk_operations_delete_entity:
               label_override: ''
+            workflow_node_given_state_action:
+              label_override: ''
             pathauto_update_alias:
               label_override: ''
           plugin_id: views_bulk_operations_bulk_form
@@ -2406,18 +2423,18 @@ display:
           entity_type: node
           entity_field: nid
           plugin_id: field
-        title:
-          id: title
-          table: node_field_data
-          field: title
+        field_reference:
+          id: field_reference
+          table: node__field_reference
+          field: field_reference
           relationship: none
           group_type: group
           admin_label: ''
-          label: Title
+          label: Reference
           exclude: false
           alter:
-            alter_text: true
-            text: '<h2>{{ title }}</h2>'
+            alter_text: false
+            text: ''
             make_link: false
             path: ''
             absolute: false
@@ -2433,8 +2450,8 @@ display:
             target: ''
             nl2br: false
             max_length: 0
-            word_boundary: false
-            ellipsis: false
+            word_boundary: true
+            ellipsis: true
             more_link: false
             more_link_text: ''
             more_link_path: ''
@@ -2442,7 +2459,7 @@ display:
             trim: false
             preserve_tags: ''
             html: false
-          element_type: h2
+          element_type: h6
           element_class: ''
           element_label_type: ''
           element_label_class: ''
@@ -2455,9 +2472,11 @@ display:
           empty_zero: false
           hide_alter_empty: true
           click_sort_column: value
-          type: string
+          type: computed_string
           settings:
-            link_to_entity: true
+            sanitized: 1
+            cache_unit: '-1'
+            cache_duration: '1'
           group_column: value
           group_columns: {  }
           group_rows: true
@@ -2468,21 +2487,19 @@ display:
           multi_type: separator
           separator: ', '
           field_api_classes: false
-          entity_type: node
-          entity_field: title
           plugin_id: field
-        field_reference:
-          id: field_reference
-          table: node__field_reference
-          field: field_reference
+        title:
+          id: title
+          table: node_field_data
+          field: title
           relationship: none
           group_type: group
           admin_label: ''
-          label: Reference
+          label: Name
           exclude: false
           alter:
-            alter_text: false
-            text: ''
+            alter_text: true
+            text: '<h2>{{ title }}</h2>'
             make_link: false
             path: ''
             absolute: false
@@ -2498,8 +2515,8 @@ display:
             target: ''
             nl2br: false
             max_length: 0
-            word_boundary: true
-            ellipsis: true
+            word_boundary: false
+            ellipsis: false
             more_link: false
             more_link_text: ''
             more_link_path: ''
@@ -2507,7 +2524,7 @@ display:
             trim: false
             preserve_tags: ''
             html: false
-          element_type: ''
+          element_type: h2
           element_class: ''
           element_label_type: ''
           element_label_class: ''
@@ -2520,11 +2537,9 @@ display:
           empty_zero: false
           hide_alter_empty: true
           click_sort_column: value
-          type: computed_string
+          type: string
           settings:
-            sanitized: 1
-            cache_unit: '-1'
-            cache_duration: '1'
+            link_to_entity: true
           group_column: value
           group_columns: {  }
           group_rows: true
@@ -2535,6 +2550,8 @@ display:
           multi_type: separator
           separator: ', '
           field_api_classes: false
+          entity_type: node
+          entity_field: title
           plugin_id: field
         field_materiau_images:
           id: field_materiau_images
@@ -2572,7 +2589,7 @@ display:
             trim: false
             preserve_tags: ''
             html: false
-          element_type: ''
+          element_type: div
           element_class: ''
           element_label_type: ''
           element_label_class: ''
@@ -2587,7 +2604,7 @@ display:
           click_sort_column: title
           type: image
           settings:
-            image_style: medium
+            image_style: card_small
             image_link: ''
           group_column: ''
           group_columns: {  }
@@ -3144,6 +3161,69 @@ display:
           separator: '<br/>'
           field_api_classes: false
           plugin_id: field
+        field_attachments:
+          id: field_attachments
+          table: node__field_attachments
+          field: field_attachments
+          relationship: none
+          group_type: group
+          admin_label: ''
+          label: Attachments
+          exclude: false
+          alter:
+            alter_text: false
+            text: ''
+            make_link: false
+            path: ''
+            absolute: false
+            external: false
+            replace_spaces: false
+            path_case: none
+            trim_whitespace: false
+            alt: ''
+            rel: ''
+            link_class: ''
+            prefix: ''
+            suffix: ''
+            target: ''
+            nl2br: false
+            max_length: 0
+            word_boundary: true
+            ellipsis: true
+            more_link: false
+            more_link_text: ''
+            more_link_path: ''
+            strip_tags: false
+            trim: false
+            preserve_tags: ''
+            html: false
+          element_type: ''
+          element_class: ''
+          element_label_type: ''
+          element_label_class: ''
+          element_label_colon: true
+          element_wrapper_type: ''
+          element_wrapper_class: ''
+          element_default_classes: true
+          empty: ''
+          hide_empty: false
+          empty_zero: false
+          hide_alter_empty: true
+          click_sort_column: target_id
+          type: file_default
+          settings:
+            use_description_as_link_text: true
+          group_column: ''
+          group_columns: {  }
+          group_rows: true
+          delta_limit: 0
+          delta_offset: 0
+          delta_reversed: false
+          delta_first_last: false
+          multi_type: separator
+          separator: ', '
+          field_api_classes: false
+          plugin_id: field
         field_workflow:
           id: field_workflow
           table: node__field_workflow
@@ -3675,7 +3755,7 @@ display:
           exposed: true
           expose:
             operator_id: title_op
-            label: Title
+            label: Name
             description: ''
             use_operator: false
             operator: title_op
@@ -3685,10 +3765,17 @@ display:
             multiple: false
             remember_roles:
               authenticated: authenticated
+              unverified: '0'
               anonymous: '0'
+              free_user: '0'
+              contact_company: '0'
+              alpha_testeur: '0'
+              student: '0'
+              adherent: '0'
+              translator: '0'
+              admin_showroom: '0'
               admin: '0'
               root: '0'
-              user: '0'
             placeholder: ''
           is_grouped: false
           group_info:
@@ -3712,7 +3799,7 @@ display:
           relationship: none
           group_type: group
           admin_label: ''
-          operator: '='
+          operator: contains
           value: ''
           group: 1
           exposed: true
@@ -3823,7 +3910,7 @@ display:
           exposed: true
           expose:
             operator_id: field_famille_value_op
-            label: Famille
+            label: Family
             description: ''
             use_operator: false
             operator: field_famille_value_op
@@ -4201,6 +4288,7 @@ display:
         - 'user.node_grants:view'
         - user.roles
       tags:
+        - 'config:field.storage.node.field_attachments'
         - 'config:field.storage.node.field_distributor'
         - 'config:field.storage.node.field_linked_articles'
         - 'config:field.storage.node.field_linked_materials'
@@ -4631,7 +4719,7 @@ display:
           click_sort_column: target_id
           type: image
           settings:
-            image_style: medium
+            image_style: card_small
             image_link: ''
           group_column: ''
           group_columns: {  }

+ 417 - 0
config/sync/views.view.entity_references.yml

@@ -0,0 +1,417 @@
+uuid: 3555fe38-1079-44a4-b09f-9573151b3080
+langcode: en
+status: true
+dependencies:
+  config:
+    - field.storage.node.field_materiau_images
+    - field.storage.node.field_reference
+    - image.style.card_small
+    - node.type.materiau
+  module:
+    - computed_field
+    - entity_reference_revisions
+    - image
+    - node
+    - user
+id: entity_references
+label: 'Entity references'
+module: views
+description: ''
+tag: ''
+base_table: node_field_data
+base_field: nid
+core: 8.x
+display:
+  default:
+    display_plugin: default
+    id: default
+    display_title: Master
+    position: 0
+    display_options:
+      access:
+        type: perm
+        options:
+          perm: 'access content'
+      cache:
+        type: tag
+        options: {  }
+      query:
+        type: views_query
+        options:
+          disable_sql_rewrite: false
+          distinct: false
+          replica: false
+          query_comment: ''
+          query_tags: {  }
+      exposed_form:
+        type: basic
+        options:
+          submit_button: Apply
+          reset_button: false
+          reset_button_label: Reset
+          exposed_sorts_label: 'Sort by'
+          expose_sort_order: true
+          sort_asc_label: Asc
+          sort_desc_label: Desc
+      pager:
+        type: mini
+        options:
+          items_per_page: 10
+          offset: 0
+          id: 0
+          total_pages: null
+          expose:
+            items_per_page: false
+            items_per_page_label: 'Items per page'
+            items_per_page_options: '5, 10, 25, 50'
+            items_per_page_options_all: false
+            items_per_page_options_all_label: '- All -'
+            offset: false
+            offset_label: Offset
+          tags:
+            previous: ‹‹
+            next: ››
+      style:
+        type: default
+        options:
+          grouping: {  }
+          row_class: ''
+          default_row_class: true
+          uses_fields: false
+      row:
+        type: fields
+        options:
+          inline: {  }
+          separator: ''
+          hide_empty: false
+          default_field_elements: true
+      fields:
+        field_materiau_images:
+          id: field_materiau_images
+          table: node__field_materiau_images
+          field: field_materiau_images
+          relationship: none
+          group_type: group
+          admin_label: ''
+          label: ''
+          exclude: false
+          alter:
+            alter_text: false
+            text: ''
+            make_link: false
+            path: ''
+            absolute: false
+            external: false
+            replace_spaces: false
+            path_case: none
+            trim_whitespace: false
+            alt: ''
+            rel: ''
+            link_class: ''
+            prefix: ''
+            suffix: ''
+            target: ''
+            nl2br: false
+            max_length: 0
+            word_boundary: true
+            ellipsis: true
+            more_link: false
+            more_link_text: ''
+            more_link_path: ''
+            strip_tags: false
+            trim: false
+            preserve_tags: ''
+            html: false
+          element_type: ''
+          element_class: ''
+          element_label_type: ''
+          element_label_class: ''
+          element_label_colon: false
+          element_wrapper_type: ''
+          element_wrapper_class: ''
+          element_default_classes: true
+          empty: ''
+          hide_empty: false
+          empty_zero: false
+          hide_alter_empty: true
+          click_sort_column: target_id
+          type: image
+          settings:
+            image_style: card_small
+            image_link: ''
+          group_column: ''
+          group_columns: {  }
+          group_rows: true
+          delta_limit: 1
+          delta_offset: 0
+          delta_reversed: false
+          delta_first_last: false
+          multi_type: separator
+          separator: ', '
+          field_api_classes: false
+          plugin_id: field
+        title:
+          id: title
+          table: node_field_data
+          field: title
+          relationship: none
+          group_type: group
+          admin_label: ''
+          label: ''
+          exclude: false
+          alter:
+            alter_text: false
+            text: ''
+            make_link: false
+            path: ''
+            absolute: false
+            external: false
+            replace_spaces: false
+            path_case: none
+            trim_whitespace: false
+            alt: ''
+            rel: ''
+            link_class: ''
+            prefix: ''
+            suffix: ''
+            target: ''
+            nl2br: false
+            max_length: 0
+            word_boundary: false
+            ellipsis: false
+            more_link: false
+            more_link_text: ''
+            more_link_path: ''
+            strip_tags: false
+            trim: false
+            preserve_tags: ''
+            html: false
+          element_type: ''
+          element_class: ''
+          element_label_type: ''
+          element_label_class: ''
+          element_label_colon: false
+          element_wrapper_type: ''
+          element_wrapper_class: ''
+          element_default_classes: true
+          empty: ''
+          hide_empty: false
+          empty_zero: false
+          hide_alter_empty: true
+          click_sort_column: value
+          type: string
+          settings:
+            link_to_entity: true
+          group_column: value
+          group_columns: {  }
+          group_rows: true
+          delta_limit: 0
+          delta_offset: 0
+          delta_reversed: false
+          delta_first_last: false
+          multi_type: separator
+          separator: ', '
+          field_api_classes: false
+          entity_type: node
+          entity_field: title
+          plugin_id: field
+        field_reference:
+          id: field_reference
+          table: node__field_reference
+          field: field_reference
+          relationship: none
+          group_type: group
+          admin_label: ''
+          label: ''
+          exclude: false
+          alter:
+            alter_text: false
+            text: ''
+            make_link: false
+            path: ''
+            absolute: false
+            external: false
+            replace_spaces: false
+            path_case: none
+            trim_whitespace: false
+            alt: ''
+            rel: ''
+            link_class: ''
+            prefix: ''
+            suffix: ''
+            target: ''
+            nl2br: false
+            max_length: 0
+            word_boundary: true
+            ellipsis: true
+            more_link: false
+            more_link_text: ''
+            more_link_path: ''
+            strip_tags: false
+            trim: false
+            preserve_tags: ''
+            html: false
+          element_type: ''
+          element_class: ''
+          element_label_type: ''
+          element_label_class: ''
+          element_label_colon: false
+          element_wrapper_type: ''
+          element_wrapper_class: ''
+          element_default_classes: true
+          empty: ''
+          hide_empty: false
+          empty_zero: false
+          hide_alter_empty: true
+          click_sort_column: value
+          type: computed_string
+          settings:
+            sanitized: 1
+            cache_unit: '-1'
+            cache_duration: '1'
+          group_column: value
+          group_columns: {  }
+          group_rows: true
+          delta_limit: 0
+          delta_offset: 0
+          delta_reversed: false
+          delta_first_last: false
+          multi_type: separator
+          separator: ', '
+          field_api_classes: false
+          plugin_id: field
+      filters:
+        status:
+          value: '1'
+          table: node_field_data
+          field: status
+          plugin_id: boolean
+          entity_type: node
+          entity_field: status
+          id: status
+          expose:
+            operator: ''
+          group: 1
+      sorts:
+        created:
+          id: created
+          table: node_field_data
+          field: created
+          order: DESC
+          entity_type: node
+          entity_field: created
+          plugin_id: date
+          relationship: none
+          group_type: group
+          admin_label: ''
+          exposed: false
+          expose:
+            label: ''
+          granularity: second
+      header: {  }
+      footer: {  }
+      empty: {  }
+      relationships: {  }
+      arguments: {  }
+      display_extenders: {  }
+    cache_metadata:
+      max-age: -1
+      contexts:
+        - 'languages:language_content'
+        - 'languages:language_interface'
+        - url.query_args
+        - 'user.node_grants:view'
+        - user.permissions
+      tags:
+        - 'config:field.storage.node.field_materiau_images'
+        - 'config:field.storage.node.field_reference'
+  entity_reference_1:
+    display_plugin: entity_reference
+    id: entity_reference_1
+    display_title: 'Entity Reference materials'
+    position: 1
+    display_options:
+      display_extenders:
+        views_ef_fieldset: {  }
+      style:
+        type: entity_reference
+        options:
+          search_fields:
+            title: title
+            field_reference: field_reference
+      filters:
+        status:
+          id: status
+          table: node_field_data
+          field: status
+          relationship: none
+          group_type: group
+          admin_label: ''
+          operator: '='
+          value: '1'
+          group: 1
+          exposed: false
+          expose:
+            operator_id: ''
+            label: ''
+            description: ''
+            use_operator: false
+            operator: ''
+            identifier: ''
+            required: false
+            remember: false
+            multiple: false
+            remember_roles:
+              authenticated: authenticated
+          is_grouped: false
+          group_info:
+            label: ''
+            description: ''
+            identifier: ''
+            optional: true
+            widget: select
+            multiple: false
+            remember: false
+            default_group: All
+            default_group_multiple: {  }
+            group_items: {  }
+          plugin_id: boolean
+          entity_type: node
+          entity_field: status
+        type:
+          id: type
+          table: node_field_data
+          field: type
+          value:
+            materiau: materiau
+          entity_type: node
+          entity_field: type
+          plugin_id: bundle
+      defaults:
+        filters: false
+        filter_groups: false
+      filter_groups:
+        operator: AND
+        groups:
+          1: AND
+      display_description: ''
+      row:
+        type: entity_reference_revisions
+        options:
+          default_field_elements: true
+          inline:
+            field_materiau_images: field_materiau_images
+            title: title
+            field_reference: field_reference
+          separator: '-'
+          hide_empty: false
+    cache_metadata:
+      max-age: -1
+      contexts:
+        - 'languages:language_content'
+        - 'languages:language_interface'
+        - 'user.node_grants:view'
+        - user.permissions
+      tags:
+        - 'config:field.storage.node.field_materiau_images'
+        - 'config:field.storage.node.field_reference'

+ 2 - 2
config/sync/workflow.transition.workflow_creation_imported.yml

@@ -11,7 +11,7 @@ module: workflow
 from_sid: workflow_creation
 to_sid: workflow_imported
 roles:
-  workflow_author: workflow_author
-  anonymous: anonymous
+  workflow_author: '0'
+  anonymous: '0'
   admin: '0'
   root: '0'

+ 9 - 0
web/modules/custom/materio_id/materio_id.module

@@ -61,7 +61,16 @@ function computed_field_field_reference_compute($entity_type_manager, $entity, $
  */
 function materio_id_form_node_materiau_edit_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
   // dsm($form_id);
+  // ksm($form);
   $node = $form_state->getFormObject()->getEntity();
+
+  // lock the family filed if already filled
+  if(isset($form['field_famille']) && $family = $node->field_famille->value){
+    // dsm($family);
+    $form['field_famille']['widget']['#disabled'] = true;
+  }
+  
+  // adding reference to the form title
   $ref = $node->field_reference->value;
   // dsm($ref);
 	if($ref != ''){