Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EPAD8-2525] Revisions dropbuttons fix #1585

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions services/drupal/composer.patches.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
"CKEditor 5 toolbar items of multi-value field (typically Paragraphs) overflowing on narrow viewports and overlapping with node form's sidebar on wide viewports": "https://www.drupal.org/files/issues/2024-04-09/3332416-79.patch",
"Allows hiding ajax errors": "https://www.drupal.org/files/issues/2024-02-05/2987444-53.patch",
"Background colour of UI widgets get overridden on Ajax load.": "https://www.drupal.org/files/issues/2023-08-29/3383631-7_0.patch",
"Provides a link to the latest revision": "https://www.drupal.org/files/issues/2023-11-30/2906455-44.patch"
"Provides a link to the latest revision": "https://www.drupal.org/files/issues/2023-11-30/2906455-44.patch",
".ck-balloon-panel (link balloon, media balloon …) not visible for CKE5 instances in a Drupal dialog" : "https://www.drupal.org/files/issues/2024-04-02/cke-balloon-panel-tooltip-z-index-3351603-29.patch"
},
"drupal/group": {
"Get a token of a node's parent group to create a pathauto pattern": "https://www.drupal.org/files/issues/2020-02-21/group-gnode_tokens-2774827-62.patch",
Expand Down Expand Up @@ -194,7 +195,8 @@
},
"drupal/diff": {
"Patch diff interface to get language to match core patches in these issues: 3252521, 2899719, and 3252540": "patches/diff-patch-revision-language-to-match-3252521-2899719-3252540-3.patch",
"Add classes to allow color-coding of revisions list": "https://www.drupal.org/files/issues/2021-12-03/diff-add_classes-3252547-2.patch"
"Add classes to allow color-coding of revisions list": "https://www.drupal.org/files/issues/2021-12-03/diff-add_classes-3252547-2.patch",
"Adjust dropbuttons to be links for https://forumone.atlassian.net/browse/EPAD8-2525": "patches/make-diff-dropbuttons-links.diff"
},
"drupal/entitygroupfield": {
"Limit available groups in widget to ones user has permission to.": "https://www.drupal.org/files/issues/2020-08-07/entitygroupfield-Autocomplete_permissions-3163814-4.patch",
Expand Down
85 changes: 85 additions & 0 deletions services/drupal/patches/make-diff-dropbuttons-links.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
diff --git a/src/Controller/PluginRevisionController.php b/src/Controller/PluginRevisionController.php
index b266591..e500934 100644
--- a/src/Controller/PluginRevisionController.php
+++ b/src/Controller/PluginRevisionController.php
@@ -168,10 +168,13 @@ class PluginRevisionController extends ControllerBase {

// Build the layout filter.
$build['controls']['diff_layout'] = [
- '#type' => 'item',
+ '#theme' => 'item_list',
+ '#type' => 'ul',
'#title' => $this->t('Layout'),
'#wrapper_attributes' => ['class' => ['diff-controls__item']],
- 'filter' => $this->buildLayoutNavigation($entity, $left_revision->getRevisionId(), $right_revision->getRevisionId(), $filter),
+ '#prefix' => '<div class="diff-controls--layout">',
+ '#suffix' => '</div>',
+ '#items' => $this->buildLayoutNavigation($entity, $left_revision->getRevisionId(), $right_revision->getRevisionId(), $filter),
];

// Perform comparison only if both entity revisions loaded successfully.
@@ -209,8 +212,9 @@ class PluginRevisionController extends ControllerBase {
$layouts = $this->diffLayoutManager->getPluginOptions();
foreach ($layouts as $key => $value) {
$links[$key] = [
- 'title' => $value,
- 'url' => $this->diffRoute($entity, $left_revision_id, $right_revision_id, $key),
+ '#type' => 'link',
+ '#title' => $value,
+ '#url' => $this->diffRoute($entity, $left_revision_id, $right_revision_id, $key),
];
}

@@ -219,12 +223,12 @@ class PluginRevisionController extends ControllerBase {
unset($links[$active_filter]);
array_unshift($links, $filter);

- $filter = [
- '#type' => 'operations',
- '#links' => $links,
- ];
+// $filter = [
+// '#type' => 'operations',
+// '#links' => $links,
+// ];

- return $filter;
+ return $links;
}

/**
diff --git a/src/Plugin/diff/Layout/VisualInlineDiffLayout.php b/src/Plugin/diff/Layout/VisualInlineDiffLayout.php
index e8c5552..c3a832b 100644
--- a/src/Plugin/diff/Layout/VisualInlineDiffLayout.php
+++ b/src/Plugin/diff/Layout/VisualInlineDiffLayout.php
@@ -155,8 +155,9 @@ class VisualInlineDiffLayout extends DiffLayoutBase {
continue;
}
$options[$view_mode] = [
- 'title' => $view_mode_info,
- 'url' => PluginRevisionController::diffRoute($entity,
+ '#type' => 'link',
+ '#title' => $view_mode_info,
+ '#url' => PluginRevisionController::diffRoute($entity,
$left_revision->getRevisionId(),
$right_revision->getRevisionId(),
'visual_inline',
@@ -182,13 +183,13 @@ class VisualInlineDiffLayout extends DiffLayoutBase {
array_unshift($options, $filter);

$build['controls']['view_mode'] = [
- '#type' => 'item',
+ '#theme' => 'item_list',
+ '#type' => 'ul',
+ '#items' => $options,
'#title' => $this->t('View mode'),
+ '#prefix' => '<div class="diff-controls--view-mode">',
+ '#suffix' => '</div>',
'#wrapper_attributes' => ['class' => ['diff-controls__item']],
- 'filter' => [
- '#type' => 'operations',
- '#links' => $options,
- ],
];

$view_builder = $this->entityTypeManager->getViewBuilder($entity->getEntityTypeId());