Commit 6d481683 authored by Kevin Paxman's avatar Kevin Paxman
Browse files

Merge branch 'feature/ISTWCMS-5337-project-merge' into '1.0.x'

Feature/istwcms 5337 project merge

See merge request !92
parents 06ded7e7 873a1bf7
......@@ -9,6 +9,7 @@ dependencies:
- node.type.uw_ct_news_item
- node.type.uw_ct_opportunity
- node.type.uw_ct_profile
- node.type.uw_ct_project
- node.type.uw_ct_service
- node.type.uw_ct_sidebar
- node.type.uw_ct_site_footer
......@@ -21,43 +22,30 @@ type: content_moderation
type_settings:
states:
draft:
published: false
default_revision: false
label: Draft
weight: -10
published: false
default_revision: false
published:
published: true
default_revision: true
label: Published
weight: -10
uw_wf_archived:
published: false
published: true
default_revision: true
uw_wf_archived:
label: Archived
weight: -10
uw_wf_needs_review:
published: false
default_revision: false
default_revision: true
uw_wf_needs_review:
label: 'Needs Review'
weight: -10
uw_wf_unpublished:
published: false
default_revision: true
default_revision: false
uw_wf_unpublished:
label: Unpublished
weight: 0
entity_types:
node:
- uw_ct_blog
- uw_ct_catalog_item
- uw_ct_contact
- uw_ct_event
- uw_ct_news_item
- uw_ct_opportunity
- uw_ct_profile
- uw_ct_service
- uw_ct_sidebar
- uw_ct_site_footer
- uw_ct_web_page
published: false
default_revision: true
transitions:
archived:
label: Archive
......@@ -101,4 +89,18 @@ type_settings:
- uw_wf_unpublished
to: draft
weight: 4
entity_types:
node:
- uw_ct_blog
- uw_ct_catalog_item
- uw_ct_contact
- uw_ct_event
- uw_ct_news_item
- uw_ct_opportunity
- uw_ct_profile
- uw_ct_project
- uw_ct_service
- uw_ct_sidebar
- uw_ct_site_footer
- uw_ct_web_page
default_moderation_state: draft
......@@ -158,6 +158,7 @@ dependencies:
- 'uw_ct_news_item:uw_ct_news_item'
- 'uw_ct_opportunities:uw_ct_opportunities'
- 'uw_ct_profile:uw_ct_profile'
- 'uw_ct_project:uw_ct_project'
- 'uw_ct_service:uw_ct_service'
- 'uw_ct_sidebar:uw_ct_sidebar'
- 'uw_ct_site_footer:uw_ct_site_footer'
......
......@@ -68,6 +68,13 @@ function uw_sites_all_install() {
function _uw_sites_all_get_menu_items(): array {
return [
'Projects' => [
'title' => 'Projects',
'menu_name' => 'main',
'route_name' => 'uw_ct_project.listing',
'weight' => 30,
'enabled' => FALSE,
],
'Opportunities' => [
'title' => 'Opportunities',
'menu_name' => 'main',
......@@ -579,3 +586,69 @@ function uw_sites_all_update_9109(array &$sandbox): void {
];
\Drupal::service('module_installer')->install($modules);
}
/**
* Enables uw_ct_project module.
*/
function uw_sites_all_update_9110(&$sandbox) {
$modules = [
'uw_ct_project',
];
\Drupal::service('module_installer')->install($modules);
// List of permissions needed to be applied to roles.
$permissions = [
'create uw_ct_project content',
'create terms in uw_vocab_project_roles',
'create terms in uw_vocab_project_topics',
'edit own uw_ct_project content',
'edit any uw_ct_project content',
'edit terms in uw_vocab_project_roles',
'edit terms in uw_vocab_project_topics',
];
$only_site_manager_permissions = [
'delete uw_ct_project content',
'delete own uw_ct_project content',
'delete terms in uw_vocab_project_roles',
'delete terms in uw_vocab_project_topics',
];
// 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();
// Create the URL from the route name.
$url = URL::fromRoute('uw_ct_project.listing')
->toString();
// Create the actual menu link.
MenuLinkContent::create([
'title' => 'Projects',
'link' => ['uri' => 'internal:' . $url],
'menu_name' => 'main',
'weight' => 30,
'enabled' => FALSE,
])->save();
}
Supports Markdown
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