From 90883384f409a1e937eb024fc4005d332bd63bf6 Mon Sep 17 00:00:00 2001 From: bach Date: Thu, 20 May 2021 19:45:21 +0200 Subject: [PATCH] added field_weight to assisted research terms for sorting --- ...axonomy_term.assisted_research.default.yml | 24 +++ ...axonomy_term.assisted_research.default.yml | 10 + ...my_term.assisted_research.field_weight.yml | 31 +++ ...eld.storage.taxonomy_term.field_weight.yml | 24 +++ config/sync/views.view.admin_taxo.yml | 197 +++++++++++++++--- .../src/Form/MaterioSapiSearchForm.php | 3 +- .../materiotheme/assets/dist/report.html | 2 +- 7 files changed, 263 insertions(+), 28 deletions(-) create mode 100644 config/sync/field.field.taxonomy_term.assisted_research.field_weight.yml create mode 100644 config/sync/field.storage.taxonomy_term.field_weight.yml diff --git a/config/sync/core.entity_form_display.taxonomy_term.assisted_research.default.yml b/config/sync/core.entity_form_display.taxonomy_term.assisted_research.default.yml index 25de3f13..306f95f9 100644 --- a/config/sync/core.entity_form_display.taxonomy_term.assisted_research.default.yml +++ b/config/sync/core.entity_form_display.taxonomy_term.assisted_research.default.yml @@ -4,6 +4,7 @@ status: true dependencies: config: - field.field.taxonomy_term.assisted_research.field_terms + - field.field.taxonomy_term.assisted_research.field_weight - taxonomy.vocabulary.assisted_research module: - field_group @@ -14,6 +15,7 @@ third_party_settings: children: - group_list - group_admin + - group_sidebar parent_name: '' weight: 1 format_type: tabs @@ -54,6 +56,21 @@ third_party_settings: formatter: closed required_fields: true label: admin + group_sidebar: + children: + - field_weight + parent_name: group_tabs + weight: 20 + format_type: tab + region: content + format_settings: + description: '' + open: '1' + required_fields: true + id: '' + classes: '' + formatter: closed + label: weight id: taxonomy_term.assisted_research.default targetEntityType: taxonomy_term bundle: assisted_research @@ -69,6 +86,13 @@ content: third_party_settings: { } type: entity_reference_autocomplete region: content + field_weight: + weight: 10 + settings: + placeholder: '' + third_party_settings: { } + type: number + region: content langcode: type: language_select weight: 3 diff --git a/config/sync/core.entity_view_display.taxonomy_term.assisted_research.default.yml b/config/sync/core.entity_view_display.taxonomy_term.assisted_research.default.yml index c7970e17..6dd31ede 100644 --- a/config/sync/core.entity_view_display.taxonomy_term.assisted_research.default.yml +++ b/config/sync/core.entity_view_display.taxonomy_term.assisted_research.default.yml @@ -4,6 +4,7 @@ status: true dependencies: config: - field.field.taxonomy_term.assisted_research.field_terms + - field.field.taxonomy_term.assisted_research.field_weight - taxonomy.vocabulary.assisted_research module: - text @@ -27,6 +28,15 @@ content: third_party_settings: { } type: entity_reference_label region: content + field_weight: + weight: 2 + label: above + settings: + thousand_separator: '' + prefix_suffix: true + third_party_settings: { } + type: number_integer + region: content hidden: langcode: true search_api_excerpt: true diff --git a/config/sync/field.field.taxonomy_term.assisted_research.field_weight.yml b/config/sync/field.field.taxonomy_term.assisted_research.field_weight.yml new file mode 100644 index 00000000..25a5432e --- /dev/null +++ b/config/sync/field.field.taxonomy_term.assisted_research.field_weight.yml @@ -0,0 +1,31 @@ +uuid: c9cbfb39-2a62-4ec4-8560-914fe2a8676f +langcode: fr +status: true +dependencies: + config: + - field.storage.taxonomy_term.field_weight + - taxonomy.vocabulary.assisted_research + module: + - unique_content_field_validation +third_party_settings: + unique_content_field_validation: + unique: false + unique_text: '' +id: taxonomy_term.assisted_research.field_weight +field_name: field_weight +entity_type: taxonomy_term +bundle: assisted_research +label: Weight +description: '' +required: false +translatable: false +default_value: + - + value: 0 +default_value_callback: '' +settings: + min: -20 + max: 20 + prefix: '' + suffix: '' +field_type: integer diff --git a/config/sync/field.storage.taxonomy_term.field_weight.yml b/config/sync/field.storage.taxonomy_term.field_weight.yml new file mode 100644 index 00000000..30c781b7 --- /dev/null +++ b/config/sync/field.storage.taxonomy_term.field_weight.yml @@ -0,0 +1,24 @@ +uuid: f7097059-91a6-4e19-9596-e2aa3f22ee5a +langcode: fr +status: true +dependencies: + module: + - field_permissions + - taxonomy +third_party_settings: + field_permissions: + permission_type: public +id: taxonomy_term.field_weight +field_name: field_weight +entity_type: taxonomy_term +type: integer +settings: + unsigned: false + size: normal +module: core +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/config/sync/views.view.admin_taxo.yml b/config/sync/views.view.admin_taxo.yml index 609f4b41..4cefde2b 100644 --- a/config/sync/views.view.admin_taxo.yml +++ b/config/sync/views.view.admin_taxo.yml @@ -8,8 +8,10 @@ dependencies: - field.storage.taxonomy_term.field_public_address - field.storage.taxonomy_term.field_public_email - field.storage.taxonomy_term.field_synonyms + - field.storage.taxonomy_term.field_terms - field.storage.taxonomy_term.field_visuels - field.storage.taxonomy_term.field_website + - field.storage.taxonomy_term.field_weight - field.storage.taxonomy_term.field_workflow - image.style.medium - taxonomy.vocabulary.assisted_research @@ -4586,9 +4588,11 @@ display: description: '' columns: views_bulk_operations_bulk_form: views_bulk_operations_bulk_form - tid: name - name: name - operations: name + field_weight: field_weight + name: field_weight + operations: field_weight + tid: field_weight + field_terms: field_terms is_locked: is_locked info: views_bulk_operations_bulk_form: @@ -4596,6 +4600,25 @@ display: separator: '' empty_column: false responsive: '' + field_weight: + sortable: true + default_sort_order: asc + align: '' + separator: '' + empty_column: false + responsive: priority-low + name: + sortable: false + default_sort_order: asc + align: '' + separator: '' + empty_column: false + responsive: '' + operations: + align: '' + separator: '' + empty_column: false + responsive: '' tid: sortable: false default_sort_order: asc @@ -4603,14 +4626,7 @@ display: separator: '' empty_column: false responsive: '' - name: - sortable: true - default_sort_order: asc - align: '' - separator: '' - empty_column: false - responsive: '' - operations: + field_terms: align: '' separator: '' empty_column: false @@ -4622,7 +4638,7 @@ display: separator: '' empty_column: false responsive: '' - default: '-1' + default: field_weight empty_table: false defaults: style: false @@ -4707,18 +4723,18 @@ display: preconfiguration: label_override: '' plugin_id: views_bulk_operations_bulk_form - tid: - id: tid - table: taxonomy_term_field_data - field: tid + field_weight: + id: field_weight + table: taxonomy_term__field_weight + field: field_weight relationship: none group_type: group admin_label: '' - label: 'Term ID' + label: Weight exclude: false alter: alter_text: false - text: '{{tid}}' + text: '' make_link: false path: '' absolute: false @@ -4734,8 +4750,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: '' @@ -4743,7 +4759,7 @@ display: trim: false preserve_tags: '' html: false - element_type: code + element_type: '' element_class: '' element_label_type: '' element_label_class: '' @@ -4756,8 +4772,10 @@ display: empty_zero: false hide_alter_empty: true click_sort_column: value - type: number_unformatted - settings: { } + type: number_integer + settings: + thousand_separator: '' + prefix_suffix: true group_column: value group_columns: { } group_rows: true @@ -4768,8 +4786,6 @@ display: multi_type: separator separator: ', ' field_api_classes: false - entity_type: taxonomy_term - entity_field: tid plugin_id: field name: id: name @@ -4888,6 +4904,133 @@ display: destination: false entity_type: taxonomy_term plugin_id: entity_operations + tid: + id: tid + table: taxonomy_term_field_data + field: tid + relationship: none + group_type: group + admin_label: '' + label: 'Term ID' + exclude: false + alter: + alter_text: false + text: '{{tid}}' + 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: code + 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: value + type: number_unformatted + settings: { } + 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: taxonomy_term + entity_field: tid + plugin_id: field + field_terms: + id: field_terms + table: taxonomy_term__field_terms + field: field_terms + relationship: none + group_type: group + admin_label: '' + label: Terms + 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: entity_reference_label + settings: + link: true + group_column: target_id + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: ul + separator: ', ' + field_api_classes: false + plugin_id: field is_locked: id: is_locked table: content_lock @@ -5105,4 +5248,6 @@ display: - url - url.query_args - user.roles - tags: { } + tags: + - 'config:field.storage.taxonomy_term.field_terms' + - 'config:field.storage.taxonomy_term.field_weight' diff --git a/web/modules/custom/materio_sapi/src/Form/MaterioSapiSearchForm.php b/web/modules/custom/materio_sapi/src/Form/MaterioSapiSearchForm.php index f6f32e39..0266228b 100644 --- a/web/modules/custom/materio_sapi/src/Form/MaterioSapiSearchForm.php +++ b/web/modules/custom/materio_sapi/src/Form/MaterioSapiSearchForm.php @@ -60,7 +60,8 @@ class MaterioSapiSearchForm extends FormBase { // // ] $query = \Drupal::entityQuery('taxonomy_term'); - $query->condition('vid', "assisted_research"); + $query->condition('vid', "assisted_research") + ->sort('field_weight', 'ASC'); $tids = $query->execute(); $terms = \Drupal\taxonomy\Entity\Term::loadMultiple($tids); diff --git a/web/themes/custom/materiotheme/assets/dist/report.html b/web/themes/custom/materiotheme/assets/dist/report.html index fa7c3973..be801cbe 100644 --- a/web/themes/custom/materiotheme/assets/dist/report.html +++ b/web/themes/custom/materiotheme/assets/dist/report.html @@ -3,7 +3,7 @@ - materio.com [19 May 2021 at 16:19] + materio.com [20 May 2021 at 17:44]