diff --git a/services/drupal/composer.json b/services/drupal/composer.json index 9c5bf3a2f3..bcabe805af 100644 --- a/services/drupal/composer.json +++ b/services/drupal/composer.json @@ -363,7 +363,8 @@ "drupal/core-project-message": true, "mglaman/composer-drupal-lenient": true, "drupal/core-vendor-hardening": true, - "php-http/discovery": true + "php-http/discovery": true, + "tbachert/spi": true } }, "autoload": { diff --git a/services/drupal/composer.lock b/services/drupal/composer.lock index efc0ba0ad7..0c45c3372d 100644 --- a/services/drupal/composer.lock +++ b/services/drupal/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "3ed08293ae2d17cb355e1c81dfba14b5", + "content-hash": "1ce23aa21a9cbd60ca273ff248da61be", "packages": [ { "name": "algolia/places", @@ -25327,7 +25327,7 @@ "platform": { "php": ">=8.2" }, - "platform-dev": {}, + "platform-dev": [], "platform-overrides": { "ext-gd": "1.0.0", "ext-opcache": "1.0.0", diff --git a/services/drupal/config/sync/block.block.gesso_local_tasks.yml b/services/drupal/config/sync/block.block.gesso_local_tasks.yml index 5c881934ab..83220050df 100644 --- a/services/drupal/config/sync/block.block.gesso_local_tasks.yml +++ b/services/drupal/config/sync/block.block.gesso_local_tasks.yml @@ -1,18 +1,15 @@ -uuid: 1af0c01b-357e-4d33-8897-af6baf9519ff +uuid: e23e91b7-ef43-40d3-b8c3-eaf0b326f0ab langcode: en status: true dependencies: module: - block_in_page_403 - - system theme: - epa_theme -_core: - default_config_hash: c-06bbElRY5sKmglk74ppgTW93Et4-EJFyNiUZMb8JY id: gesso_local_tasks theme: epa_theme region: messages -weight: -21 +weight: 0 provider: null plugin: local_tasks_block settings: @@ -27,7 +24,3 @@ visibility: id: page_403 negate: false page_403: 0 - request_path: - id: request_path - negate: true - pages: '/node/*' diff --git a/services/drupal/config/sync/user.role.authenticated.yml b/services/drupal/config/sync/user.role.authenticated.yml index eb16ed7c15..5768de2709 100644 --- a/services/drupal/config/sync/user.role.authenticated.yml +++ b/services/drupal/config/sync/user.role.authenticated.yml @@ -151,7 +151,6 @@ permissions: - 'use text format restricted_html' - 'use text format restricted_html_no_links' - 'use text format webform_default' - - use_epa_node_tabs - 'view all revisions' - 'view any unpublished content' - 'view any webform submission' diff --git a/services/drupal/web/modules/custom/epa_web_areas/epa_web_areas.links.task.yml b/services/drupal/web/modules/custom/epa_web_areas/epa_web_areas.links.task.yml index 25f982cdc8..74bf43b70d 100644 --- a/services/drupal/web/modules/custom/epa_web_areas/epa_web_areas.links.task.yml +++ b/services/drupal/web/modules/custom/epa_web_areas/epa_web_areas.links.task.yml @@ -23,10 +23,10 @@ epa_web_areas.my_web_areas: epa_web_areas.node_group_dashboard: route_name: page_manager.page_view_group_view_group_view-layout_builder-0 - title: 'Back to group dashboard' + title: 'Group dashboard' base_route: entity.node.canonical class: '\Drupal\epa_web_areas\Plugin\Menu\NodeGroupTab' - weight: -100 + weight: 9 epa_web_areas.group_type_allowed_bulk_change_nodes: title: 'Allowed Bulk Change Entity Bundles' diff --git a/services/drupal/web/modules/custom/epa_workflow/epa_workflow.module b/services/drupal/web/modules/custom/epa_workflow/epa_workflow.module index 69fdcbb898..029716dcf0 100644 --- a/services/drupal/web/modules/custom/epa_workflow/epa_workflow.module +++ b/services/drupal/web/modules/custom/epa_workflow/epa_workflow.module @@ -5,8 +5,11 @@ * Contains epa_workflow.module. */ +use Drupal\block\Entity\Block; use Drupal\content_moderation\Entity\ContentModerationStateInterface; +use Drupal\content_moderation\Form\EntityModerationForm; use Drupal\content_moderation_notifications\ContentModerationNotificationInterface; +use Drupal\Core\Access\AccessResult; use Drupal\Core\Datetime\DrupalDateTime; use Drupal\Core\Entity\Display\EntityViewDisplayInterface; use Drupal\Core\Entity\EntityInterface; @@ -15,6 +18,7 @@ use Drupal\Core\Entity\RevisionLogInterface; use Drupal\Core\Field\BaseFieldDefinition; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Link; +use Drupal\Core\Session\AccountInterface; use Drupal\Core\Site\Settings; use Drupal\Core\Url; use Drupal\datetime\Plugin\Field\FieldType\DateTimeItemInterface; @@ -378,7 +382,10 @@ function epa_workflow_entity_view(array &$build, EntityInterface $entity, Entity return; } - build_content_moderation_info_box($entity, $build); + // Logic to ensure that only non-beta tester role users get to see the 'old' content moderation info box. + if (!in_array('beta_tester', \Drupal::currentUser()->getRoles())) { + build_content_moderation_info_box($entity, $build); + } } } @@ -525,18 +532,18 @@ function build_content_moderation_info_box(EntityInterface $entity, array &$buil '#markup' => $renderer->render($flag_link), ]; -// $build['epa_content_moderation_info_box'] = [ -// '#theme' => 'epa_content_info_box', -// '#node_edit_link' => $node_edit_link, -// '#nid' => $nid, -// '#vid' => $vid, -// '#revision_author' => $revision_author, -// '#review_deadline' => $review_deadline, -// '#current' => $current, -// '#flag_link' => $flag_link_item, -// '#content_moderation_form' => \Drupal::formBuilder() -// ->getForm(EntityModerationForm::class, $entity), -// ]; + $build['epa_content_moderation_info_box'] = [ + '#theme' => 'epa_content_info_box', + '#node_edit_link' => $node_edit_link, + '#nid' => $nid, + '#vid' => $vid, + '#revision_author' => $revision_author, + '#review_deadline' => $review_deadline, + '#current' => $current, + '#flag_link' => $flag_link_item, + '#content_moderation_form' => \Drupal::formBuilder() + ->getForm(EntityModerationForm::class, $entity), + ]; } /** @@ -548,6 +555,17 @@ function build_content_moderation_info_box(EntityInterface $entity, array &$buil * @see \Drupal\epa_workflow\Plugin\Block\EpaNodeTabsBlock */ function epa_workflow_menu_local_tasks_alter(array &$data, $route_name) { + + // Hide the node edit tab always. This is added back as a separate button in the epa_content_info_box + if (isset($data['tabs'][0]['entity.node.edit_form'])) { + unset($data['tabs'][0]['entity.node.edit_form']); + } + + // This should only be altered if the user has the permission to the new node tabs. + if (!\Drupal::currentUser()->hasPermission('use_epa_node_tabs')) { + return; + } + // Order: // - Back to group dashboard // - Edit page layout @@ -565,6 +583,7 @@ function epa_workflow_menu_local_tasks_alter(array &$data, $route_name) { 'title' => 'Content', ], 'epa_web_areas.node_group_dashboard' => [ + 'title' => 'Back to group dashboard', 'weight' => -100 ], 'layout_builder_ui:layout_builder.overrides.node.view' => [ @@ -619,6 +638,7 @@ function epa_workflow_menu_local_tasks_alter(array &$data, $route_name) { } } } + } /** @@ -1049,3 +1069,26 @@ function epa_workflow_page_top(array &$page_top) { } } } + +/** + * Implements hook_block_access(). + * + * @todo: Remove this once the local task redesign work becomes the standard for all. + */ +function epa_workflow_block_access(Block $block, $operation, AccountInterface $account) { + // The core local tasks are special now with the local task redesign work. + // We want to only have the standard local tasks shown if: + // 1. Not on a node page + // 2. If we are on a node page AND the user does not have the "Beta Tester" role + if ($block->id() == 'gesso_local_tasks') { + // First check to see if we're on a node route. + if (!\Drupal::routeMatch()->getParameter('node')) { + return AccessResult::neutral(); + } + + // Must mean we're on a node route so check if the user is a beta tester + if ($account->hasRole('beta_tester')) { + return AccessResult::forbidden(); + } + } +} diff --git a/services/drupal/web/modules/custom/epa_workflow/src/Form/EPAContentModerationEntityModerationForm.php b/services/drupal/web/modules/custom/epa_workflow/src/Form/EPAContentModerationEntityModerationForm.php index 47d81ecab3..7ac98b721a 100644 --- a/services/drupal/web/modules/custom/epa_workflow/src/Form/EPAContentModerationEntityModerationForm.php +++ b/services/drupal/web/modules/custom/epa_workflow/src/Form/EPAContentModerationEntityModerationForm.php @@ -183,9 +183,15 @@ private function addPublishDateField(array &$form, NodeInterface $node) { private function tweakFormClasses(array &$form) { $form['new_state']['#title'] = t('Change state to'); $form['new_state']['#wrapper_attributes']['class'][] = 'epa-content-moderation__fancy-select'; - $form['revision_log']['#wrapper_attributes']['class'][] = 'epa-content-moderation__form-item'; + $form['workflow_508_compliant']['#wrapper_attributes']['class'][] = 'epa-content-moderation__form-item'; - $form['submit']['#attributes']['class'][] = 'button--primary'; + if (isset($form['submit'])) { + $form['submit']['#attributes']['class'][] = 'button--primary'; + } + + if (isset($form['revision_log'])) { + $form['revision_log']['#wrapper_attributes']['class'][] = 'epa-content-moderation__form-item'; + } } /** @@ -214,9 +220,11 @@ private function adjustStateOptions(array &$form) { * @return void */ private function adjustRevisionLog(array &$form) { - $form['revision_log']['#title'] = t('Revision notes'); - $form['revision_log']['#type'] = 'textarea'; - unset($form['revision_log']['#size']); + if (isset($form['revision_log'])) { + $form['revision_log']['#title'] = t('Revision notes'); + $form['revision_log']['#type'] = 'textarea'; + unset($form['revision_log']['#size']); + } } /** diff --git a/services/drupal/web/modules/custom/epa_workflow/src/Plugin/Block/ContentinfoBoxBlock.php b/services/drupal/web/modules/custom/epa_workflow/src/Plugin/Block/ContentinfoBoxBlock.php index 64d3b48692..c2db021b1b 100644 --- a/services/drupal/web/modules/custom/epa_workflow/src/Plugin/Block/ContentinfoBoxBlock.php +++ b/services/drupal/web/modules/custom/epa_workflow/src/Plugin/Block/ContentinfoBoxBlock.php @@ -14,6 +14,7 @@ use Drupal\Core\Template\Attribute; use Drupal\Core\Url; use Drupal\epa_workflow\ModerationStateToColorMapTrait; +use Drupal\node\Entity\Node; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -100,6 +101,10 @@ protected function blockAccess(AccountInterface $account) { return AccessResultForbidden::forbidden(); } + if (!\Drupal::currentUser()->hasPermission('use_epa_node_tabs')) { + return AccessResultForbidden::forbidden(); + } + // This block doesn't make sense on the below routes. // - Node revisions listing page. // - Node delete form. diff --git a/services/drupal/web/modules/custom/epa_workflow/templates/epa-content-moderation-form.html.twig b/services/drupal/web/modules/custom/epa_workflow/templates/epa-content-moderation-form.html.twig index ded2f9bb4b..0f289fe6e4 100644 --- a/services/drupal/web/modules/custom/epa_workflow/templates/epa-content-moderation-form.html.twig +++ b/services/drupal/web/modules/custom/epa_workflow/templates/epa-content-moderation-form.html.twig @@ -6,13 +6,17 @@
{{ current_state }} - + {% if content_moderation_form|render|striptags|trim is not empty %} + + {% endif %} -
- {{ content_moderation_form }} -
+ {% if content_moderation_form|render|striptags|trim is not empty %} +
+ {{ content_moderation_form }} +
+ {% endif %}

{{ last_modified }}

{{ help_text }}

diff --git a/services/drupal/web/themes/epa_theme/source/_patterns/utility-classes/_index.scss b/services/drupal/web/themes/epa_theme/source/_patterns/utility-classes/_index.scss index d7835c6463..e62db5627a 100644 --- a/services/drupal/web/themes/epa_theme/source/_patterns/utility-classes/_index.scss +++ b/services/drupal/web/themes/epa_theme/source/_patterns/utility-classes/_index.scss @@ -3,3 +3,4 @@ @forward 'clearfix'; @forward 'full-width'; @forward 'print'; +@forward 'spaced'; diff --git a/services/drupal/web/themes/epa_theme/source/_patterns/utility-classes/_spaced.scss b/services/drupal/web/themes/epa_theme/source/_patterns/utility-classes/_spaced.scss new file mode 100644 index 0000000000..25903fb72c --- /dev/null +++ b/services/drupal/web/themes/epa_theme/source/_patterns/utility-classes/_spaced.scss @@ -0,0 +1,28 @@ +// @file +// Vertical spacing utility classes. + +@use '../00-config' as *; + +$sizes: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15; + +@each $size in $sizes { + .u-spaced-#{$size}, + .u-spaced-#{$size}-above { + margin-block-start: #{rem(gesso-spacing($size))} !important; + } + + .u-spaced-#{$size}, + .u-spaced-#{$size}-below { + margin-block-end: #{rem(gesso-spacing($size))} !important; + } +} + +.u-spaced-none, +.u-spaced-none-above { + margin-block-start: 0 !important; +} + +.u-spaced-none, +.u-spaced-none-below { + margin-block-end: 0 !important; +} diff --git a/services/drupal/web/themes/epa_theme/templates/misc/epa-content-info-box.html.twig b/services/drupal/web/themes/epa_theme/templates/misc/epa-content-info-box.html.twig index e938bb153a..e4ce2548b0 100644 --- a/services/drupal/web/themes/epa_theme/templates/misc/epa-content-info-box.html.twig +++ b/services/drupal/web/themes/epa_theme/templates/misc/epa-content-info-box.html.twig @@ -1,6 +1,10 @@ +{% if node_edit_link %} + {{ node_edit_link }} +{% endif %} + {% set box_content %} {% if flag_link %} - {{ flag_link }} +
{{ flag_link }}
{% endif %} {% if nid %} @@ -67,7 +71,7 @@ {% endif %} {% if content_moderation_form %} - {{ content_moderation_form }} +
{{ content_moderation_form }}
{% endif %} {% endset %}