Issue #2285311 by joelpittet, tomatkins, susannecoates: Theme's "Path to custom logo" always validated even if "Use the default logo" is set

8.2.x
Alex Pott 2016-05-19 11:15:20 +01:00
parent 628ffc0c44
commit 5fa8126d00
2 changed files with 22 additions and 0 deletions

View File

@ -379,6 +379,16 @@ class ThemeSettingsForm extends ConfigFormBase {
}
}
// When intending to use the default logo, unset the logo_path.
if ($form_state->getValue('default_logo')) {
$form_state->unsetValue('logo_path');
}
// When intending to use the default favicon, unset the favicon_path.
if ($form_state->getValue('default_favicon')) {
$form_state->unsetValue('favicon_path');
}
// If the user provided a path for a logo or favicon file, make sure a file
// exists at that path.
if ($form_state->getValue('logo_path')) {

View File

@ -201,6 +201,18 @@ class ThemeTest extends WebTestBase {
$this->assertLink($theme_handler->getName('stable'));
$this->drupalGet('admin/appearance/settings/stable');
$this->assertResponse(200, 'The theme settings form URL for a hidden theme that is the admin theme is available.');
// Ensure default logo and favicons are not triggering custom path
// validation errors if their custom paths are set on the form.
$edit = [
'default_logo' => TRUE,
'logo_path' => 'public://whatever.png',
'default_favicon' => TRUE,
'favicon_path' => 'public://whatever.ico',
];
$this->drupalPostForm('admin/appearance/settings', $edit, 'Save configuration');
$this->assertNoText('The custom logo path is invalid.');
$this->assertNoText('The custom favicon path is invalid.');
}
/**