diff --git a/CHANGELOG.md b/CHANGELOG.md index b792cc7ded..adeb0ce5c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ +## [0.387.1] - January 31, 2024 + +### Removed + - DP-24989: Removed custom code changes breaking autocomplete filtering + ## [0.387.0] - January 29, 2024 ### Fixed @@ -16,6 +21,7 @@ ### Fixed - DP-31612: HOTFIX for broken autocomplete for organization field on user create. + ## [0.386.0] - January 23, 2024 ### Changed diff --git a/conf/drupal/config/views.view.link_field_autocomplete.yml b/conf/drupal/config/views.view.link_field_autocomplete.yml deleted file mode 100644 index a8831e092e..0000000000 --- a/conf/drupal/config/views.view.link_field_autocomplete.yml +++ /dev/null @@ -1,255 +0,0 @@ -uuid: 0c529b4f-a678-4a6f-963c-1149885b663d -langcode: en -status: true -dependencies: - module: - - node - - user -id: link_field_autocomplete -label: 'Link field autocomplete' -module: views -description: '' -tag: '' -base_table: node_field_data -base_field: nid -display: - default: - id: default - display_title: Default - display_plugin: default - position: 0 - display_options: - fields: - title: - id: title - table: node_field_data - field: title - relationship: none - group_type: group - admin_label: '' - entity_type: node - entity_field: title - plugin_id: field - label: '' - exclude: false - alter: - alter_text: false - make_link: false - absolute: false - word_boundary: false - ellipsis: false - strip_tags: false - trim: false - 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: 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 - type: - id: type - table: node_field_data - field: type - relationship: none - group_type: group - admin_label: '' - entity_type: node - entity_field: type - plugin_id: field - label: '' - exclude: true - 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: entity_reference_label - settings: - link: false - group_column: target_id - 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 - pager: - type: mini - options: - offset: 0 - items_per_page: 10 - total_pages: null - id: 0 - tags: - next: ›› - previous: ‹‹ - 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 - 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 - access: - type: perm - options: - perm: 'access content' - cache: - type: tag - options: { } - empty: { } - sorts: { } - arguments: { } - filters: - status: - id: status - table: node_field_data - field: status - entity_type: node - entity_field: status - plugin_id: boolean - value: '1' - group: 1 - expose: - operator: '' - style: - type: default - options: - grouping: { } - row_class: '' - default_row_class: true - uses_fields: false - row: - type: fields - options: - default_field_elements: true - inline: { } - separator: '' - hide_empty: false - query: - type: views_query - options: - query_comment: '' - disable_sql_rewrite: false - distinct: false - disable_automatic_base_fields: false - replica: false - query_tags: { } - relationships: { } - header: { } - footer: { } - display_extenders: { } - cache_metadata: - max-age: -1 - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - url.query_args - - 'user.node_grants:view' - - user.permissions - tags: { } - entity_reference: - id: entity_reference - display_title: 'Entity Reference' - display_plugin: entity_reference - position: 1 - display_options: - pager: - type: some - options: - offset: 0 - items_per_page: 100 - style: - type: entity_reference - options: - search_fields: - title: title - row: - type: entity_reference - options: - default_field_elements: true - inline: { } - separator: '-' - hide_empty: false - display_extenders: - metatag_display_extender: - metatags: { } - tokenize: false - cache_metadata: - max-age: -1 - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - 'user.node_grants:view' - - user.permissions - tags: { } diff --git a/docroot/modules/custom/mass_utility/mass_utility.module b/docroot/modules/custom/mass_utility/mass_utility.module index eb33e221e3..93ba790432 100644 --- a/docroot/modules/custom/mass_utility/mass_utility.module +++ b/docroot/modules/custom/mass_utility/mass_utility.module @@ -445,20 +445,6 @@ function mass_utility_field_widget_single_element_form_alter(&$element, FormStat $element['uri']['#description'] = 'Start typing to choose an existing page on Mass.gov, or enter a complete URL to another site. If you want to add an external link, it must begin with "https://" or "http://".'; } - // DP-24989: Override core link field widget to custom view to solve custom sorting by bundle. - if ($supportsInternal) { - // We are changing behaviour only when target type is node. - if ($element['uri']['#type'] == 'entity_autocomplete' && $element['uri']['#target_type'] == 'node') { - $element['uri']['#selection_handler'] = 'views'; - $element['uri']['#selection_settings'] = [ - 'view' => [ - 'view_name' => 'link_field_autocomplete', - 'display_name' => 'entity_reference', - ], - ]; - } - } - // Remove the domain from the field prefix for internal only links. if ($field_definition->getSetting('link_type') === 1) { if (isset($element['uri']['#field_prefix'])) { @@ -560,33 +546,7 @@ function mass_utility_field_widget_single_element_form_alter(&$element, FormStat } } } - elseif ($type == 'entity_reference_hierarchy') { - - // DP-24989: Override entity_reference_hierarchy field widget to custom view to solve custom sorting by bundle. - // We are changing behaviour only when target type is node. - if (isset($element['target_id']['target_id']['#type']) && $element['target_id']['target_id']['#type'] == 'entity_autocomplete' && $element['target_id']['target_id']['#target_type'] == 'node') { - $element['target_id']['target_id']['#selection_handler'] = 'views'; - $element['target_id']['target_id']['#selection_settings'] = [ - 'view' => [ - 'view_name' => 'link_field_autocomplete', - 'display_name' => 'entity_reference', - ], - ]; - } - } elseif ($type == 'entity_reference') { - - // DP-24989: Override core entity_reference field widget to custom view to solve custom sorting by bundle. - // We are changing behaviour only when target type is node. - if (isset($element['target_id']['#type']) && $element['target_id']['#type'] == 'entity_autocomplete' && $element['target_id']['#target_type'] == 'node') { - $element['target_id']['#selection_handler'] = 'views'; - $element['target_id']['#selection_settings'] = [ - 'view' => [ - 'view_name' => 'link_field_autocomplete', - 'display_name' => 'entity_reference', - ], - ]; - } if ($field_name == 'field_issuer_issuers') { if ($element['target_id']['#field_parents'][0] == 'field_advisory_issuer') { $element['target_id']['#ajax'] = [ diff --git a/docroot/modules/custom/mass_views/mass_views.module b/docroot/modules/custom/mass_views/mass_views.module index 764dec13d8..3f704c5a4e 100644 --- a/docroot/modules/custom/mass_views/mass_views.module +++ b/docroot/modules/custom/mass_views/mass_views.module @@ -142,38 +142,6 @@ function mass_views_form_views_exposed_form_alter(&$form, FormStateInterface $fo */ function mass_views_views_query_alter(ViewExecutable $view, QueryPluginBase $query) { - // DP-24989: alter the view to custom sort autocomplete results by bundle. - if ($view->id() == "link_field_autocomplete" && $view->getDisplay()->display['id'] == 'entity_reference') { - // Add a case statement to the sort criteria. - $order_case = "CASE - WHEN node_field_data.type = 'org_page' THEN 1 - WHEN node_field_data.type = 'topic_page' THEN 2 - WHEN node_field_data.type = 'service_page' THEN 3 - WHEN node_field_data.type = 'how_to_page' THEN 4 - WHEN node_field_data.type = 'decision_tree' THEN 5 - WHEN node_field_data.type = 'info_details' THEN 6 - WHEN node_field_data.type = 'curated_list' THEN 7 - WHEN node_field_data.type = 'binder' THEN 8 - WHEN node_field_data.type = 'location_details' THEN 9 - WHEN node_field_data.type = 'location' THEN 10 - WHEN node_field_data.type = 'form_page' THEN 11 - WHEN node_field_data.type = 'guide_page' THEN 12 - WHEN node_field_data.type = 'campaign_landing' THEN 13 - WHEN node_field_data.type = 'regulation' THEN 14 - WHEN node_field_data.type = 'advisory' THEN 15 - WHEN node_field_data.type = 'decision' THEN 16 - WHEN node_field_data.type = 'executive_order' THEN 17 - WHEN node_field_data.type = 'news' THEN 18 - WHEN node_field_data.type = 'event' THEN 19 - WHEN node_field_data.type = 'rules' THEN 20 - WHEN node_field_data.type = 'contact_information' THEN 21 - WHEN node_field_data.type = 'person' THEN 22 - ELSE 23 - END"; - - $query->addOrderBy(NULL, $order_case, 'ASC', 'custom_sort'); - } - if ($view->id() == "report_d2d_redirects" && $view->getDisplay()->display['id'] == 'page_1') { // See DP-23382 for more info. // The functions used below help to filter the view with the url alias