Commit 740e3058 authored by Chris Shantz's avatar Chris Shantz
Browse files

Merge branch '1.0.x' into prod/1.0.x

parents db3c9054 53e2cc11
......@@ -68,6 +68,13 @@ function uw_sites_all_install() {
function _uw_sites_all_get_menu_items(): array {
return [
'Opportunities' => [
'title' => 'Opportunities',
'menu_name' => 'main',
'route_name' => 'view.uw_view_opportunities.opportunities_page',
'weight' => 35,
'enabled' => FALSE,
],
'Contacts' => [
'title' => 'Contacts',
'menu_name' => 'main',
......@@ -110,6 +117,13 @@ function _uw_sites_all_get_menu_items(): array {
'weight' => 65,
'enabled' => FALSE,
],
'Services' => [
'title' => 'Services',
'menu_name' => 'main',
'route_name' => 'view.uw_view_services.services_page',
'weight' => 48,
'enabled' => FALSE,
],
];
}
......@@ -374,3 +388,157 @@ function uw_sites_all_update_8138() {
$config->set('general_settings.visual_inline_theme', NULL);
$config->save();
}
/**
* Enables Anchor Link module.
*/
function uw_sites_all_update_9101(&$sandbox) {
\Drupal::service('module_installer')->install(['anchor_link']);
}
/**
* Enables uw_ct_service permissions.
*/
function uw_sites_all_update_9102(&$sandbox) {
// List of permissions needed to be applied to roles.
$permissions = [
'clone uw_ct_service content',
'configure editable uw_ct_service node layout overrides',
'create uw_ct_service content',
'create terms in uw_vocab_service_categories',
'edit own uw_ct_service content',
'edit any uw_ct_service content',
'edit terms in uw_vocab_service_categories',
'revert uw_ct_service revisions',
'view uw_ct_service revisions',
'enter uw_ct_service revision log entry',
'override uw_ct_service published option',
'override uw_ct_service revision option',
];
$only_site_manager_permissions = [
'delete any uw_ct_service content',
'delete own uw_ct_service content',
'delete terms in uw_vocab_service_categories',
];
// Roles that require updated permissions.
$role_ids = [
'uw_role_site_manager',
'uw_role_content_editor',
'uw_role_content_author',
];
$roles = Role::loadMultiple($role_ids);
// Grant all all roles.
foreach ($permissions as $permission) {
$roles['uw_role_site_manager']->grantPermission($permission);
$roles['uw_role_content_editor']->grantPermission($permission);
$roles['uw_role_content_author']->grantPermission($permission);
}
foreach ($only_site_manager_permissions as $only_site_manager_permission) {
$roles['uw_role_site_manager']->grantPermission($only_site_manager_permission);
}
// Save role with new permissions.
$roles['uw_role_site_manager']->save();
$roles['uw_role_content_editor']->save();
$roles['uw_role_content_author']->save();
}
/**
* Add services menu default disabled.
*/
function uw_sites_all_update_9103(&$sandbox) {
// Prepare the disabled Services menu item.
$menu_item = [
'title' => 'Services',
'menu_name' => 'main',
'route_name' => 'view.uw_view_services.services_page',
'weight' => 48,
'enabled' => FALSE,
];
// Create the URL from the route name.
$url = URL::fromRoute($menu_item['route_name'])->toString();
// Create the actual menu link.
MenuLinkContent::create([
'title' => $menu_item['title'],
'link' => ['uri' => 'internal:' . $url],
'menu_name' => $menu_item['menu_name'],
'weight' => $menu_item['weight'],
'enabled' => $menu_item['enabled'],
])->save();
}
/**
* Add the disabled Opportunities to main menu.
*/
function uw_sites_all_update_9104(&$sandbox) {
// Create the URL from the route name.
$url = URL::fromRoute('view.uw_view_opportunities.opportunities_page')
->toString();
// Create the actual menu link.
MenuLinkContent::create([
'title' => 'Opportunities',
'link' => ['uri' => 'internal:' . $url],
'menu_name' => 'main',
'weight' => 35,
'enabled' => FALSE,
])->save();
}
/**
* Enables uw_ct_opportunities permissions.
*/
function uw_sites_all_update_9105(&$sandbox) {
// List of permissions needed to be applied to roles.
$permissions = [
'clone uw_ct_opportunity content',
'configure editable uw_ct_opportunity node layout overrides',
'create uw_ct_opportunity content',
'edit own uw_ct_opportunity content',
'edit any uw_ct_opportunity content',
'revert uw_ct_opportunity revisions',
'view uw_ct_opportunity revisions',
'enter uw_ct_opportunity revision log entry',
'override uw_ct_opportunity published option',
'override uw_ct_opportunity revision option',
];
$only_site_manager_permissions = [
'delete any uw_ct_opportunity content',
'delete own uw_ct_opportunity content',
];
// Roles that require updated permissions.
$role_ids = [
'uw_role_site_manager',
'uw_role_content_editor',
'uw_role_content_author',
];
$roles = Role::loadMultiple($role_ids);
// Grant all all roles.
foreach ($permissions as $permission) {
$roles['uw_role_site_manager']->grantPermission($permission);
$roles['uw_role_content_editor']->grantPermission($permission);
$roles['uw_role_content_author']->grantPermission($permission);
}
foreach ($only_site_manager_permissions as $only_site_manager_permission) {
$roles['uw_role_site_manager']->grantPermission($only_site_manager_permission);
}
// Save role with new permissions.
$roles['uw_role_site_manager']->save();
$roles['uw_role_content_editor']->save();
$roles['uw_role_content_author']->save();
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment