Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.0.5 release #532

Merged
merged 2 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"drupal/domain_path": "^1.2",
"drupal/field_formatter_class": "^1.5",
"drupal/ginvite": "^4.0@RC",
"drupal/group": "^3.2",
"drupal/group": "^3.3",
"drupal/group_content_menu": "^3.0",
"drupal/group_context_domain": "^1.0",
"drupal/group_sites": "^1.0",
Expand Down
18 changes: 17 additions & 1 deletion localgov_microsites_group.module
Original file line number Diff line number Diff line change
Expand Up @@ -237,21 +237,37 @@ function localgov_microsites_group_form_alter(&$form, FormStateInterface $form_s
if (isset($form['domain_path'])) {
$domain_ids = Element::children($form['domain_path']);
$active_domain = \Drupal::service('domain.negotiator')->getActiveDomain();
$domain_access = [];
foreach ($domain_ids as $id) {

// Hide path auto settings for all but the active domain.
if ($id !== $active_domain->id()) {
$form['domain_path'][$id]['#access'] = FALSE;
}
else {
$domain_access[] = ['target_id' => $id];
}

// Set domain path pathauto as on by default for new nodes.
elseif (
if (
$form_state->getFormObject() instanceof EntityFormInterface &&
$form_state->getFormObject()->getEntity()->isNew()
) {
$form['domain_path'][$id]['pathauto']['#default_value'] = TRUE;
}
}

// The Domain Path module does a lot of checks for domain access
// configuration, but we use the Group module for access checks. Adding the
// domain access field to the form ensures the Domain Path checks pass, but
// is a bit of a hack as it would be better to fix whatever is going wrong
// in the Domain Path module.
if (!isset($form['field_domain_access'])) {
$form['field_domain_access'] = [
'#type' => 'value',
'#value' => $domain_access,
];
}
}
}

Expand Down