Inline logo SVG.
Closes #3345259
Merge request reports
Activity
added 1 commit
- 54ef5dda - Included rendered version the logo so attributes are added to images that are...
added 1 commit
- ebc0824b - Fixed PHPCS violation. Parameter $image_factory is not described in comment
added 1 commit
- e6ecf4a4 - Fixed PHPCS violation. Parameter $image_factory is not described in comment.
18 19 {% block content %} 19 20 {% if site_logo %} 20 21 <a href="{{ path('<front>') }}" rel="home"> 21 <img src="{{ site_logo }}" alt="{{ 'Home'|t }}" fetchpriority="high" /> 22 {% if site_logo|split('.')|last == "svg" %} @catch I don't follow, "...given the actual markup is the same...". One includes the SVG file inline using an
<svg>
tag, the other renders the image using an<img>
tag. The markup is not the same.@catch The conditional is not only on which variable to use. Each of those variables are rendered differently. The SVG uses
{% include ... %}
to execute the statement and insert the contents of the file. The other uses{{ ... }}
to print the variable. If we only use one variable,{{ ... }}
is going to print the file URI in the case for SVGs, not insert the file contents.If I can include the content of the SVG when creating the variable, and print that using
{{ ... }}
the SVG content is printed as a string.Is there a way I can include the contents of the SVG when building the variable and pass that to the Twig file such that it will be rendered properly? With everything I have tried, I either get the SVG contents printed as a string, or nothing.
changed this line in version 6 of the diff
added 1 commit
- a3b9036b - Move extension logic to the block plugin, and allow templates to render the logo the same way.
313 313 switch ($variables['base_plugin_id']) { 314 314 case 'system_branding_block': 315 315 $variables['site_logo'] = ''; 316 if ($variables['content']['site_logo']['#access'] && $variables['content']['site_logo']['#uri']) { 317 $variables['site_logo'] = $variables['content']['site_logo']['#uri']; 316 if ($variables['content']['site_logo']['#access']) { 317 $variables['site_logo'] = $variables['content']['site_logo']; - Comment on lines +316 to +317
@catch I believe this would not be needed if
{{ content.site_logo }}
is used in the template, but would that be considered a breaking change? Since,$site_logo
is defined and used currently.
added 1 commit
- 88c15792 - Check if index exists and explicitly check if it is TRUE. Fixes failing...
added 63 commits
-
88c15792...a0a7640c - 53 commits from branch
project:11.x
- 9c8937d2 - Inline logo SVG.
- c4dd8ddb - Included rendered version the logo so attributes are added to images that are...
- 390f1b7b - Fixed PHPCS violation. Parameter $image_factory is not described in comment
- 91da2eae - Fixed PHPCS violation. Parameter $image_factory is not described in comment.
- 6af0fb13 - Fixed PHPCS violation.
- 05a59136 - Move extension logic to the block plugin, and allow templates to render the logo the same way.
- 317419a3 - Remove documentation for unused variable.
- 73346ffe - Fix PHPCS violation.
- f919acf5 - Remove extra space.
- 775cd53d - Check if index exists and explicitly check if it is TRUE. Fixes failing...
Toggle commit list-
88c15792...a0a7640c - 53 commits from branch
added 11 commits
- 3a1cecfd - 1 earlier commit
- 54ef5dda - Included rendered version the logo so attributes are added to images that are...
- ebc0824b - Fixed PHPCS violation. Parameter $image_factory is not described in comment
- e6ecf4a4 - Fixed PHPCS violation. Parameter $image_factory is not described in comment.
- d8a5b282 - Fixed PHPCS violation.
- a3b9036b - Move extension logic to the block plugin, and allow templates to render the logo the same way.
- 1fbe9911 - Remove documentation for unused variable.
- 00c98e93 - Fix PHPCS violation.
- 0842bb43 - Remove extra space.
- 88c15792 - Check if index exists and explicitly check if it is TRUE. Fixes failing...
- a48829a0 - Merge remote-tracking branch 'drupal-3345259/3345259-logo-inline-svg' into 3345259-logo-inline-svg
Toggle commit listadded 158 commits
-
a48829a0...19f88bd3 - 157 commits from branch
project:11.x
- 4245c996 - Merge branch '11.x' into 3345259-logo-inline-svg
-
a48829a0...19f88bd3 - 157 commits from branch