Skip to content

Commit

Permalink
Merge branch '11.6.1-release' of github.com:SU-HSDO/suhumsci into shs…
Browse files Browse the repository at this point in the history
…-5996-5997-fix-wysiwyg-link-styles
  • Loading branch information
cienvaras committed Dec 19, 2024
2 parents 4b7fa7e + a12f965 commit 846d8d7
Show file tree
Hide file tree
Showing 6 changed files with 154 additions and 124 deletions.
30 changes: 22 additions & 8 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# READY FOR REVIEW

## Summary
_[briefly summarize the changes here]_
# Summary
_[briefly summarize the changes here. TL;DR - what's this PR for?]_

## Need Review By (Date)
_['10/30', 'asap', etc.]_
_[When does this need to be reviewed by? '10/30', 'asap', etc.]_

## Urgency
_['low', 'medium', 'high', etc.]_
Expand All @@ -13,6 +11,22 @@ _['low', 'medium', 'high', etc.]_
1. _[First testing step]_
2. ...

## PR Checklist
- [PR Checklist](https://gist.github.com/sherakama/0ba17601381e3adbe0cad566ad4d80a5)
- [Humsci Basic PR Checklist](https://github.com/SU-HSDO/suhumsci/blob/develop/docs/HumsciBasicPRChecklist.md)
# Review Tasks

## Backend / Functional Validation
### Code
- [ ] Are the naming conventions following our standards?
- [ ] Are PHP functions and variables in `snake_case` and not `camelCase`?
- [ ] Does Drupal code follow [Drupal Coding Standards](https://www.drupal.org/docs/develop/standards/php/php-coding-standards)?
- [ ] Does the code have sufficient inline comments?
- [ ] Is there anything in this code that would be hidden or hard to discover through the UI?
- [ ] Are there any [code smells](https://blog.codinghorror.com/code-smells/)?
- [ ] Are tests provided?

### Code security
- [ ] Is all [user input properly sanitized when rendered](https://www.drupal.org/docs/8/security/drupal-8-sanitizing-output)?
- [ ] Any obvious [security flaws or new areas for attack](https://www.drupal.org/docs/8/security)?

### General
- [ ] Is there anything included in this PR that is not related to the problem it is trying to solve?
- [ ] Is the approach to the problem appropriate?
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
uuid: 7e424b1f-3692-41a3-a48a-dd1a450e0203
langcode: en
status: true
dependencies:
module:
- stanford_samlauth
theme:
- humsci_colorful
id: humsci_colorful_samlsunetidlogoutblock
theme: humsci_colorful
region: footer
weight: 0
provider: null
plugin: stanford_samlauth_logout_block
settings:
id: stanford_samlauth_logout_block
label: 'SAML SUNetID Logout Block'
label_display: '0'
provider: stanford_samlauth
link_text: 'SUNetID Logout'
visibility: { }
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
uuid: 2f7f0d52-c463-411d-a2e2-656d185acd4d
langcode: en
status: true
dependencies:
module:
- stanford_samlauth
theme:
- humsci_traditional
id: humsci_traditional_samlsunetidlogoutblock
theme: humsci_traditional
region: footer
weight: 0
provider: null
plugin: stanford_samlauth_logout_block
settings:
id: stanford_samlauth_logout_block
label: 'SAML SUNetID Logout Block'
label_display: '0'
provider: stanford_samlauth
link_text: 'SUNetID Logout'
visibility: { }
106 changes: 0 additions & 106 deletions config/default/views.view.hs_default_people.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1719,59 +1719,6 @@ display:
multi_type: separator
separator: ', '
field_api_classes: false
edit_node:
id: edit_node
table: node
field: edit_node
relationship: none
group_type: group
admin_label: ''
entity_type: node
plugin_id: entity_link_edit
label: ''
exclude: false
alter:
alter_text: false
text: '<div class="button">{{ edit_node }}</div>'
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: hs-button
element_label_type: ''
element_label_class: ''
element_label_colon: false
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
text: edit
output_url_as_text: false
absolute: false
field_hs_person_department:
id: field_hs_person_department
table: node__field_hs_person_department
Expand Down Expand Up @@ -2786,59 +2733,6 @@ display:
multi_type: separator
separator: ', '
field_api_classes: false
edit_node:
id: edit_node
table: node
field: edit_node
relationship: none
group_type: group
admin_label: ''
entity_type: node
plugin_id: entity_link_edit
label: ''
exclude: false
alter:
alter_text: false
text: '<div class="button">{{ edit_node }}</div>'
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: hs-button
element_label_type: ''
element_label_class: ''
element_label_colon: false
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
text: edit
output_url_as_text: false
absolute: false
field_hs_person_faculty_status:
id: field_hs_person_faculty_status
table: node__field_hs_person_faculty_status
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@ use Drupal\hs_entities\Entity\HsEntityType;
use Drupal\node\NodeInterface;
use Drupal\paragraphs\Entity\ParagraphsType;
use Drupal\user\RoleInterface;
use Drush\Drush;

/**
* Implements hook_requirements().
*/
function su_humsci_profile_requirements($phase) {
$requirements = [];
if ($phase == 'runtime') {

$site_path = DrupalKernel::findSitePath(\Drupal::request());
$site_path = explode('/', $site_path);
$site_name = $site_path[1];
Expand Down Expand Up @@ -75,7 +73,11 @@ function su_humsci_profile_update_9606() {
$entity_type_manager = \Drupal::entityTypeManager();
$config_factory = \Drupal::configFactory();

\Drupal::service('module_installer')->install(['menu_link', 'cshs', 'token_or']);
\Drupal::service('module_installer')->install([
'menu_link',
'cshs',
'token_or',
]);
$config_factory->getEditable('menu_link_weight.settings')
->set('menu_parent_form_selector', 'cshs')
->save();
Expand Down Expand Up @@ -110,7 +112,8 @@ function su_humsci_profile_update_9607() {
$field_config_storage = $entity_type_manager->getStorage('field_config');
$bundles = [];
/** @var \Drupal\node\Entity\NodeType $node_type */
foreach ($entity_type_manager->getStorage('node_type')->loadMultiple() as $node_type) {
foreach ($entity_type_manager->getStorage('node_type')
->loadMultiple() as $node_type) {
if ($node_type->getThirdPartySetting('menu_ui', 'available_menus')) {
$bundles[] = $node_type->id();
$node_type->setThirdPartySetting('menu_ui', 'available_menus', []);
Expand Down Expand Up @@ -479,7 +482,8 @@ function su_humsci_profile_update_9701(&$sandbox) {

// Clear entity caches.
$entity_type_manager->getStorage($eck_type)->resetCache([$id]);
$entity_type_manager->getStorage('hs_entity')->resetCache([$new_entity->id()]);
$entity_type_manager->getStorage('hs_entity')
->resetCache([$new_entity->id()]);
}
$sandbox['#finished'] = empty($sandbox['items']) ? 1 : ($sandbox['count'] - count($sandbox['items'])) / $sandbox['count'];

Expand Down Expand Up @@ -852,7 +856,8 @@ function _su_humsci_profile_get_uuid(string $config_name): string|null {
* Uninstall legacy themes.
*/
function su_humsci_profile_update_9705() {
$installed_themes = \Drupal::service('extension.list.theme')->getAllInstalledInfo();
$installed_themes = \Drupal::service('extension.list.theme')
->getAllInstalledInfo();
$legacy_themes = [
'archaeology',
'francestanford',
Expand Down Expand Up @@ -1096,7 +1101,7 @@ function su_humsci_profile_update_9718() {
// Remove webform existing config - needs to be done before uninstall.
$config_factory = \Drupal::configFactory();

$config_names = array_filter($config_factory->listAll(), function ($item) {
$config_names = array_filter($config_factory->listAll(), function($item) {
return str_contains($item, 'webform');
});

Expand All @@ -1113,6 +1118,70 @@ function su_humsci_profile_update_9718() {
* Uninstall hs_webform and webform modules.
*/
function su_humsci_profile_update_9719() {
/** @var \Drupal\user\RoleInterface[] $roles */
$roles = \Drupal::entityTypeManager()
->getStorage('user_role')
->loadMultiple();
foreach ($roles as $role) {
foreach (array_filter($role->getPermissions(), fn($perm) => str_contains($perm, 'webform')) as $perm) {
$role->revokePermission($perm);
}
$role->trustData()->save();
}
// Uninstalls modules after removing configs to prevent updb errors.
\Drupal::service('module_installer')->uninstall(['hs_webform', 'webform_ui', 'webform']);
\Drupal::service('module_installer')->uninstall([
'hs_webform',
'webform_ui',
'webform',
]);
}

/**
* Add new logout block to existing sites.
*/
function su_humsci_profile_update_9720() {
$block_storage = \Drupal::entityTypeManager()->getStorage('block');
/** @var Drupal\block\Entity\Block[] $login_blocks */
$login_blocks = $block_storage->loadByProperties([
'plugin' => 'stanford_samlauth_login_block',
]);
$log_out = 'SUNetID Logout';

if ($login_blocks) {
$login_block = reset($login_blocks);
$settings = $login_block->get('settings');

$log_in = $settings['link_text'];
$log_out = preg_replace('/in\b/', 'out', $log_in);
$log_out = preg_replace('/In\b/', 'Out', $log_out);
$log_out = str_replace(' to ', ' from ', $log_out);
$log_out = str_replace(' To ', ' From ', $log_out);
}

$block_info = [
'status' => TRUE,
'region' => 'footer',
'plugin' => 'stanford_samlauth_logout_block',
'weight' => 0,
'settings' => [
'id' => 'stanford_samlauth_logout_block',
'label' => 'SAML SUNetID Logout Block',
'label_display' => 0,
'provider' => 'stanford_samlauth',
'link_text' => $log_out,
],
'visibility' => [],
];
$block_storage->create([
'uuid' => '7e424b1f-3692-41a3-a48a-dd1a450e0203',
'id' => 'humsci_colorful_samlsunetidlogoutblock',
'theme' => 'humsci_colorful',
...$block_info,
])->save();
$block_storage->create([
'uuid' => '2f7f0d52-c463-411d-a2e2-656d185acd4d',
'id' => 'humsci_traditional_samlsunetidlogoutblock',
'theme' => 'humsci_traditional',
...$block_info,
])->save();
}
Original file line number Diff line number Diff line change
Expand Up @@ -875,11 +875,22 @@ function su_humsci_profile_form_user_register_form_alter(&$form, FormStateInterf
/**
* Implements hook_preprocess_HOOK().
*/
function su_humsci_profile_preprocess_block__stanford_samlauth(&$variables) {
$variables['content']['login']['#attributes']['class'] = [
function su_humsci_profile_preprocess_block(&$variables) {
$classes = [
'text-align-right',
'hs-secondary-button',
];

$base_plugin_id = $variables['base_plugin_id'];

switch ($base_plugin_id) {
case 'stanford_samlauth_login_block':
$variables['content']['login']['#attributes']['class'] = $classes;
break;

case 'stanford_samlauth_logout_block':
$variables['content']['logout']['#attributes']['class'] = $classes;
}
}

/**
Expand Down

0 comments on commit 846d8d7

Please sign in to comment.