Issue #3436526: Adjust custom logo dimensions
4 unresolved threads
Closes #3436526
Merge request reports
Activity
added 2 commits
added 43 commits
-
b3cefc19...f479374e - 41 commits from branch
project:11.x
- 44123872 - Merge remote-tracking branch 'origin/11.x' into 3436526-create-image-styles
- 2b8411a6 - Issue #3436526: Adjustments after #3443810
-
b3cefc19...f479374e - 41 commits from branch
added 1 commit
212 $logo_managed = $form_state->getValue('logo_managed'); 213 $config = $this->config('navigation.settings'); 214 if (empty($logo_managed)) { 215 return; 216 } 217 218 // Skip if the fid has not been modified. 219 $fid = reset($logo_managed); 220 if ($fid == $config->get('logo_managed')) { 221 return; 222 } 223 224 $file = $this->entityTypeManager->getStorage('file') 225 ->load($fid); 226 if ($fid && !$this->adjustLogoDimensions($file)) { 227 /* cspell:disable-next-line */ changed this line in version 8 of the diff
62 // saved as permanent if settings are not submitted. 63 $image_field = $this->assertSession()->hiddenFieldExists('logo_managed[fids]'); 64 $file = File::load($image_field->getValue()); 65 $this->assertFalse($file->isPermanent()); 66 67 $page->pressButton('Save configuration'); 68 \Drupal::entityTypeManager()->getStorage('file')->resetCache(); 69 70 $this->drupalGet("/admin/config/user-interface/navigation/settings"); 71 72 // Assert the uploaded file is saved as permanent. 73 $image_field = $this->assertSession()->hiddenFieldExists('logo_managed[fids]'); 74 $file = File::load($image_field->getValue()); 75 $this->assertTrue($file->isPermanent()); 76 77 // Ensure that image has been resized to fit in the expected container. changed this line in version 8 of the diff
26 26 return $needs_save; 27 27 }); 28 28 } 29 30 /** 31 * Defines the values for the default logo dimensions and adjust the logo. changed this line in version 8 of the diff
214 $logo_managed = $form_state->getValue('logo_managed'); 215 $config = $this->config('navigation.settings'); 216 if (empty($logo_managed)) { 217 return; 218 } 219 220 // Skip if the fid has not been modified. 221 $fid = reset($logo_managed); 222 if ($fid == $config->get('logo_managed')) { 223 return; 224 } 225 226 $file = $this->entityTypeManager->getStorage('file') 227 ->load($fid); 228 if ($fid && !$this->adjustLogoDimensions($file)) { 229 $form_state->setErrorByName('logo_managed', 'Image dimensions are bigger than the expected %widthx%heightpx and cannot be used as Navigation logo'); Related to @quietone's remarks here, I see a couple of problems with this. First, the error message is not translated. Second, I think the intention is to interpolate the width and height into the message. Finally, we should present the width and height in the error message the same as in
adjustLogoDimensions
to be consistent. I'll take a stab at fixing these. That will remove the need for the cspell exception.changed this line in version 9 of the diff
added 1 commit
Please register or sign in to reply