Commit d4e6e818 authored by Chris Shantz's avatar Chris Shantz
Browse files

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

parents 3f4fa892 2656761e
......@@ -6,5 +6,5 @@ dependencies:
id: node_delete_action
label: 'Delete content'
type: node
plugin: node_delete_action
plugin: 'entity:delete_action:node'
configuration: { }
......@@ -6,5 +6,5 @@ dependencies:
id: node_publish_action
label: 'Publish content'
type: node
plugin: node_publish_action
plugin: 'entity:publish_action:node'
configuration: { }
......@@ -6,5 +6,5 @@ dependencies:
id: node_save_action
label: 'Save content'
type: node
plugin: node_save_action
plugin: 'entity:save_action:node'
configuration: { }
......@@ -6,5 +6,5 @@ dependencies:
id: node_unpublish_action
label: 'Unpublish content'
type: node
plugin: node_unpublish_action
plugin: 'entity:unpublish_action:node'
configuration: { }
......@@ -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'
......
......@@ -57,6 +57,12 @@ function uw_sites_all_install() {
'enabled' => $menu_item['enabled'],
])->save();
}
// Scheduler: enables "Hide seconds" option on time settings.
$scheduler_config = \Drupal::service('config.factory')->getEditable('scheduler.settings');
if ($scheduler_config) {
$scheduler_config->set('hide_seconds', TRUE)->save();
}
}
/**
......@@ -68,6 +74,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 +592,107 @@ 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();
}
/**
* Enables scheduler and scheduler_content_moderation_integration modules.
*/
function uw_sites_all_update_9111(array &$sandbox): void {
$modules = [
'scheduler',
'scheduler_content_moderation_integration',
];
\Drupal::service('module_installer')->install($modules);
// Scheduler: enables "Hide seconds" option on time settings.
$scheduler_config = \Drupal::service('config.factory')->getEditable('scheduler.settings');
if ($scheduler_config) {
$scheduler_config->set('hide_seconds', TRUE)->save();
}
// Updating system actions to new ids.
$old_new_action_id_map = [
'node_publish_action' => 'entity:publish_action:node',
'node_unpublish_action' => 'entity:unpublish_action:node',
'node_save_action' => 'entity:save_action:node',
'node_delete_action' => 'entity:delete_action:node',
'comment_publish_action' => 'entity:publish_action:comment',
'comment_unpublish_action' => 'entity:unpublish_action:comment',
'comment_save_action' => 'entity:save_action:comment',
'comment_delete_action' => 'entity:delete_action:comment',
];
/** @var \Drupal\system\Entity\Action[] $actions */
$actions = \Drupal::entityTypeManager()->getStorage('action')->loadMultiple();
foreach ($actions as $action) {
if (isset($old_new_action_id_map[$action->id()])) {
$action->setPlugin($old_new_action_id_map[$action->id()]);
$action->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