Commit 5fa8126d authored by alexpott's avatar alexpott

Issue #2285311 by joelpittet, tomatkins, susannecoates: Theme's "Path to...

Issue #2285311 by joelpittet, tomatkins, susannecoates: Theme's "Path to custom logo" always validated even if "Use the default logo" is set
parent 628ffc0c
......@@ -379,6 +379,16 @@ public function validateForm(array &$form, FormStateInterface $form_state) {
}
}
// 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')) {
......
......@@ -201,6 +201,18 @@ function testThemeSettings() {
$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.');
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment