- 🇺🇸United States smustgrave
Tagging for framework input. If this is a path we want to go down.
- Status changed to Needs work
almost 2 years ago 5:50pm 28 February 2023 - 🇺🇸United States smustgrave
This issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge request → as a guide.
Think it will help for steps to reproduce this bug.
With a UI change before/after screenshots should be added to the issue summary.
- 🇪🇸Spain eduardo morales alberti Spain, 🇪🇺
The current theme condition is not shown on blocks because of:
https://git.drupalcode.org/project/drupal/-/blob/10.1.x/core/modules/blo...// @todo Allow list of conditions to be configured in // https://www.drupal.org/node/2284687. $visibility = $this->entity->getVisibility(); $definitions = $this->manager->getFilteredDefinitions('block_ui', $form_state->getTemporaryValue('gathered_contexts'), ['block' => $this->entity]); foreach ($definitions as $condition_id => $definition) { // Don't display the current theme condition. if ($condition_id == 'current_theme') { continue; }
Should we recover this condition?
- 🇪🇸Spain eduardo morales alberti Spain, 🇪🇺
We are changing the plugin because of https://www.drupal.org/project/google_tag/issues/3263122 ✨ Recovery the current theme condition plugin Active , to be able to load the google tag on any theme, and recover this plugin on the module. Now is excluded because is not possible to select any theme.
- 🇪🇸Spain eduardo morales alberti Spain, 🇪🇺
Updated to apply to the last drupal version
- last update
over 1 year ago 29,800 pass, 4 fail - @eduardo-morales-alberti opened merge request.
- 🇪🇸Spain eduardo morales alberti Spain, 🇪🇺
Added patch also and diff between last commit and the current one, allowing blocks to use the current theme condition.
- Status changed to Needs review
over 1 year ago 1:22pm 6 July 2023 - last update
over 1 year ago 29,800 pass, 4 fail - 🇪🇸Spain eduardo morales alberti Spain, 🇪🇺
Added steps to test and captures as asked by @smustgrave
- Status changed to Needs work
over 1 year ago 2:02pm 6 July 2023 - 🇪🇸Spain eduardo morales alberti Spain, 🇪🇺
I will review the failed tests https://www.drupal.org/pift-ci-job/2710393 →
- last update
over 1 year ago 29,801 pass, 2 fail - last update
over 1 year ago 29,801 pass, 2 fail - last update
over 1 year ago 29,802 pass - Status changed to Needs review
over 1 year ago 3:23pm 7 July 2023 - last update
over 1 year ago 29,802 pass - 🇺🇸United States smustgrave
I think the test coverage is okay.
But found the workflow a little odd.
I did a Standard install
Went to block layout
Added a block under the Olivero tab but have it only appear on the claro theme.
Tagging for usability for thatNow if we had a global block layout tab then this setting would make sense I think.
Will leave in review for framework manager thoughts.
- 🇪🇸Spain eduardo morales alberti Spain, 🇪🇺
@smustgrave Do you think the options should be "current theme" or "any" in the case of block layout? instead of the list of all themes.
For the block layout, it have sense because it has theme tabs, for other cases, the list should have all themes - Status changed to Postponed: needs info
over 1 year ago 6:57am 10 July 2023 - 🇫🇮Finland lauriii Finland
Could someone expand the issue summary to explain why is this setting needed? Drupal Block UI is built so that blocks are intended to be specific to a theme. If we want to change that, it would be helpful to understand why that's desired.
- 🇪🇸Spain eduardo morales alberti Spain, 🇪🇺
@lauriii You are totally right, I miss the original scope of the issue.
We use current theme condition on google_tag module, but we need the "- any -" option https://www.drupal.org/project/google_tag/issues/3263122 ✨ Recovery the current theme condition plugin Active to have the ability to use google_tag on all themes or only on a theme, for blocks the current_theme condition does not have any sense at all, I will remove the logic that I changed related with blocks and update the summary.
- Status changed to Needs work
over 1 year ago 7:58am 10 July 2023 - last update
over 1 year ago 29,804 pass - last update
over 1 year ago 29,804 pass - Status changed to Needs review
over 1 year ago 10:27am 10 July 2023 - 🇪🇸Spain eduardo morales alberti Spain, 🇪🇺
Seems like the block is the only drupal core entity that uses the "plugin.manager.condition", and the current theme is excluded in this case as explained in previous comments so in the example I will use the google_tag scenario.
- 🇳🇱Netherlands yoroy
Why a select list here when all the other variations of this use checkboxes?
- Status changed to Needs work
over 1 year ago 2:18am 18 July 2023 - 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10
-
+++ b/core/modules/system/src/Plugin/Condition/CurrentThemeCondition.php @@ -111,11 +112,18 @@ public function evaluate() { + $summary = $this->isNegated() ? + $this->t('The current theme is not @theme.', ['@theme' => $theme]) : $this->t('The current theme is @theme.', ['@theme' => $theme]); + } + else { + $summary = $this->isNegated() ? + $this->t('The current theme is not one of the enabled themes.') : $this->t('The current theme is one of the enabled themes.'); } - return $this->t('The current theme is @theme', ['@theme' => $this->configuration['theme']]); + return $summary;
we can return early here and avoid using else
-
+++ b/core/tests/Drupal/KernelTests/Core/Plugin/Condition/CurrentThemeConditionTest.php @@ -27,12 +27,20 @@ public function testCurrentTheme() { + $this->assertEquals(new FormattableMarkup('The current theme is not one of the enabled themes.', ['@theme' => '']), $condition_any_negated->summary());
This feels like a UX WTF?
How can a current theme not be one of the enabled themes?
So as such I think we probably want to prevent the negate option when 'Any' is selected
Nice work folks
-
- 🇩🇪Germany Anybody Porta Westfalica
Just ran into this when working on ✨ Create an admin route condition plugin or add generic "Current theme" options for admin and default theme Active and I think we should rate this as major issue, because currently once you saved the conditions, this condition is always added and evaluated and user has no way to disable this rule?!
- 🇩🇪Germany Anybody Porta Westfalica
One important addition: The form element should be checkboxes, not radio!
It makes no sense to force selecting only one theme!Selecting no theme at all should always evaluate to TRUE!