Skip to content

Commit

Permalink
Merge pull request #2375 from massgov/hotfix/0.387.1
Browse files Browse the repository at this point in the history
Hotfix/0.387.1
  • Loading branch information
weitzman authored Jan 31, 2024
2 parents ffc25b0 + f212c37 commit bfe10e5
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 327 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -16,6 +21,7 @@
### Fixed
- DP-31612: HOTFIX for broken autocomplete for organization field on user create.


## [0.386.0] - January 23, 2024

### Changed
Expand Down
255 changes: 0 additions & 255 deletions conf/drupal/config/views.view.link_field_autocomplete.yml

This file was deleted.

40 changes: 0 additions & 40 deletions docroot/modules/custom/mass_utility/mass_utility.module
Original file line number Diff line number Diff line change
Expand Up @@ -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'])) {
Expand Down Expand Up @@ -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'] = [
Expand Down
32 changes: 0 additions & 32 deletions docroot/modules/custom/mass_views/mass_views.module
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bfe10e5

Please sign in to comment.