Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
f46096ae
Commit
f46096ae
authored
10 years ago
by
Alex Pott
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#2348793
by ACF, nlisgo | csakiistvan: Fixed I can not uninstall Classy theme .
parent
5a538117
No related branches found
No related tags found
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/modules/system/src/Controller/SystemController.php
+11
-1
11 additions, 1 deletion
core/modules/system/src/Controller/SystemController.php
core/modules/system/src/Tests/System/ThemeTest.php
+60
-0
60 additions, 0 deletions
core/modules/system/src/Tests/System/ThemeTest.php
with
71 additions
and
1 deletion
core/modules/system/src/Controller/SystemController.php
+
11
−
1
View file @
f46096ae
...
@@ -250,7 +250,17 @@ public function themesPage() {
...
@@ -250,7 +250,17 @@ public function themesPage() {
}
}
if
(
!
empty
(
$theme
->
status
))
{
if
(
!
empty
(
$theme
->
status
))
{
if
(
!
$theme
->
is_default
)
{
if
(
!
$theme
->
is_default
)
{
if
(
$theme
->
getName
()
!=
$admin_theme
)
{
$theme_uninstallable
=
TRUE
;
if
(
$theme
->
getName
()
==
$admin_theme
)
{
$theme_uninstallable
=
FALSE
;
}
// Check it isn't the base of theme of an installed theme.
foreach
(
$theme
->
required_by
as
$themename
=>
$dependency
)
{
if
(
!
empty
(
$themes
[
$themename
]
->
status
))
{
$theme_uninstallable
=
FALSE
;
}
}
if
(
$theme_uninstallable
)
{
$theme
->
operations
[]
=
array
(
$theme
->
operations
[]
=
array
(
'title'
=>
$this
->
t
(
'Uninstall'
),
'title'
=>
$this
->
t
(
'Uninstall'
),
'url'
=>
Url
::
fromRoute
(
'system.theme_uninstall'
),
'url'
=>
Url
::
fromRoute
(
'system.theme_uninstall'
),
...
...
This diff is collapsed.
Click to expand it.
core/modules/system/src/Tests/System/ThemeTest.php
+
60
−
0
View file @
f46096ae
...
@@ -267,4 +267,64 @@ function testInvalidTheme() {
...
@@ -267,4 +267,64 @@ function testInvalidTheme() {
$this
->
assertText
(
t
(
'This theme requires the base theme @base_theme to operate correctly.'
,
array
(
'@base_theme'
=>
'not_real_test_basetheme'
)));
$this
->
assertText
(
t
(
'This theme requires the base theme @base_theme to operate correctly.'
,
array
(
'@base_theme'
=>
'not_real_test_basetheme'
)));
$this
->
assertText
(
t
(
'This theme requires the theme engine @theme_engine to operate correctly.'
,
array
(
'@theme_engine'
=>
'not_real_engine'
)));
$this
->
assertText
(
t
(
'This theme requires the theme engine @theme_engine to operate correctly.'
,
array
(
'@theme_engine'
=>
'not_real_engine'
)));
}
}
/**
* Test uninstalling of themes works.
*/
function
testUninstallingThemes
()
{
// Install Bartik and set it as the default theme.
\Drupal
::
service
(
'theme_handler'
)
->
install
(
array
(
'bartik'
));
// Set up seven as the admin theme.
\Drupal
::
service
(
'theme_handler'
)
->
install
(
array
(
'seven'
));
$edit
=
array
(
'admin_theme'
=>
'seven'
,
'use_admin_theme'
=>
TRUE
,
);
$this
->
drupalPostForm
(
'admin/appearance'
,
$edit
,
t
(
'Save configuration'
));
$this
->
drupalGet
(
'admin/appearance'
);
$this
->
clickLink
(
t
(
'Set as default'
));
// Check that seven cannot be uninstalled as it is the admin theme.
$this
->
assertNoRaw
(
'Uninstall Seven theme'
,
'A link to uninstall the Seven theme does not appear on the theme settings page.'
);
// Check that bartik cannot be uninstalled as it is the default theme.
$this
->
assertNoRaw
(
'Uninstall Bartik theme'
,
'A link to uninstall the Bartik theme does not appear on the theme settings page.'
);
// Check that the classy theme cannot be uninstalled as it is a base theme
// of seven and bartik.
$this
->
assertNoRaw
(
'Uninstall Classy theme'
,
'A link to uninstall the Classy theme does not appear on the theme settings page.'
);
// Install Stark and set it as the default theme.
\Drupal
::
service
(
'theme_handler'
)
->
install
(
array
(
'stark'
));
$edit
=
array
(
'admin_theme'
=>
'stark'
,
'use_admin_theme'
=>
TRUE
,
);
$this
->
drupalPostForm
(
'admin/appearance'
,
$edit
,
t
(
'Save configuration'
));
// Check that seven can be uninstalled now.
$this
->
assertRaw
(
'Uninstall Seven theme'
,
'A link to uninstall the Seven theme does appear on the theme settings page.'
);
// Check that the classy theme still cannot be uninstalled as it is a
// base theme of bartik.
$this
->
assertNoRaw
(
'Uninstall Classy theme'
,
'A link to uninstall the Classy theme does not appear on the theme settings page.'
);
// Change the default theme to stark, stark is third in the list.
$this
->
clickLink
(
t
(
'Set as default'
),
2
);
// Check that bartik can be uninstalled now.
$this
->
assertRaw
(
'Uninstall Bartik theme'
,
'A link to uninstall the Bartik theme does appear on the theme settings page.'
);
// Check that the classy theme still can't be uninstalled as neither of it's
// base themes have been.
$this
->
assertNoRaw
(
'Uninstall Classy theme'
,
'A link to uninstall the Classy theme does not appear on the theme settings page.'
);
// Uninstall each of the three themes starting with Bartik.
$this
->
clickLink
(
t
(
'Uninstall'
));
$this
->
assertRaw
(
'The <em class="placeholder">Bartik</em> theme has been uninstalled'
);
// Seven is the second in the list.
$this
->
clickLink
(
t
(
'Uninstall'
));
$this
->
assertRaw
(
'The <em class="placeholder">Seven</em> theme has been uninstalled'
);
// Now uninstall classy.
$this
->
clickLink
(
t
(
'Uninstall'
));
$this
->
assertRaw
(
'The <em class="placeholder">Classy</em> theme has been uninstalled'
);
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment