Commit 72ce8e93 authored by Chris Shantz's avatar Chris Shantz
Browse files

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

parents 8dc02473 4fd03442
node_revision_delete_cron: 50
node_revision_delete_time: -1
node_revision_delete_time: 86400
node_revision_delete_minimum_age_to_delete_time:
max_number: 12
time: months
node_revision_delete_when_to_delete_time:
max_number: 12
time: months
delete_newer: false
disable_donation: 1
......@@ -161,6 +161,7 @@ dependencies:
- drupal:webform_ui
- drupal:workbench_access
- drupal:workflows
- override_node_options:override_node_options
- uw_ckeditor_plugins:uw_ckeditor_plugins
- uw_ws_ofis:uw_ws_ofis
libraries:
......
......@@ -5,6 +5,8 @@
* Install, update and uninstall for UW Sites all.
*/
use Drupal\user\Entity\Role;
/**
* Implements hook_install().
*/
......@@ -83,3 +85,62 @@ function uw_sites_all_update_8103() {
$config = \Drupal::service('config.factory')->getEditable('webform.settings');
$config->set('third_party_settings.honeypot.honeypot', TRUE)->save();
}
/**
* Enable Override Node Options module and assigns permissions to roles.
*/
function uw_sites_all_update_8104() {
\Drupal::service('module_installer')->install(['override_node_options']);
// List of permissions needed to be applied to roles.
$permissions = [
'enter uw_ct_blog revision log entry',
'enter uw_ct_catalog_item revision log entry',
'enter uw_ct_contact revision log entry',
'enter uw_ct_event revision log entry',
'enter uw_ct_news_item revision log entry',
'enter uw_ct_profile revision log entry',
'enter uw_ct_web_page revision log entry',
'override uw_ct_blog promote to front page option',
'override uw_ct_blog published option',
'override uw_ct_blog revision option',
'override uw_ct_blog sticky option',
'override uw_ct_catalog_item published option',
'override uw_ct_catalog_item revision option',
'override uw_ct_contact published option',
'override uw_ct_contact revision option',
'override uw_ct_event promote to front page option',
'override uw_ct_event published option',
'override uw_ct_event revision option',
'override uw_ct_event sticky option',
'override uw_ct_news_item promote to front page option',
'override uw_ct_news_item published option',
'override uw_ct_news_item revision option',
'override uw_ct_news_item sticky option',
'override uw_ct_profile published option',
'override uw_ct_profile revision option',
'override uw_ct_web_page published option',
'override uw_ct_web_page revision option',
];
// 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);
}
// Save role with new permissions.
$roles['uw_role_site_manager']->save();
$roles['uw_role_content_editor']->save();
$roles['uw_role_content_author']->save();
}
......@@ -5,9 +5,9 @@
* Workbench module file.
*/
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\menu_link_content\Entity\MenuLinkContent;
use Drupal\webform\WebformInterface;
/**
* Implements hook_form_BASE_FORM_ID_alter().
......@@ -131,9 +131,9 @@ function uw_sites_all_update_projects_alter(&$projects) {
/**
* Implements hook_ENTITY_TYPE_presave().
*/
function uw_sites_all_webform_presave(EntityInterface $webform): void {
function uw_sites_all_webform_presave(WebformInterface $webform): void {
// Add a Webform CAPTCHA component to each newly-created Webform.
if ($webform->isNew()) {
if ($webform->isNew() && empty($webform->getElementsRaw())) {
$elements = [
'captcha' => [
'#type' => 'captcha',
......
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