How to troubleshoot the SVG not showing up in hook_rrssb_buttons()

Created on 19 February 2019, about 6 years ago
Updated 16 May 2023, almost 2 years ago

I'm trying to add a custom button for the LINE messaging app, but the SVG logo isn't showing up. The hover color, no popup, and so on are processed correctly, but the SVG doesn't appear.

I minified the SVG using www.svgminify.com. I can open the SVG as a file without any problem. This is what my hook looks like:

function mymodule_rrssb_buttons() {
  $buttons = array(
    // https://developers.line.biz/en/docs/messaging-api/using-line-url-scheme/#sending-text-messages
    // https://upload.wikimedia.org/wikipedia/commons/4/41/LINE_logo.svg
    // https://www.svgminify.com/
    'line' => array(
      'svg' => '<svg version="1.1" viewBox="0 0 300 300.01" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><metadata><rdf:RDF><cc:Work rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/><dc:title/></cc:Work></rdf:RDF></metadata><defs><clipPath id="a"><path d="m0 595.28h841.89v-595.28h-841.89v595.28z"/></clipPath></defs><g transform="matrix(1.25 0 0 -1.25 -424.52 605.65)"><g clip-path="url(#a)"><g transform="matrix(1.6639 0 0 1.6639 535.7 483.72)"><path d="m0 0h-91.246c-14.327 0.019-26.093-11.583-26.114-25.914v-91.246c-0.018-14.332 11.585-26.099 25.914-26.118h91.247c14.33-0.018 26.091 11.583 26.113 25.917v91.247c0.02 14.332-11.581 26.094-25.914 26.114" fill="#00b900"/></g><g transform="matrix(1.6639 0 0 1.6639 546.03 375)"><path d="m0 0c0 23.342-23.4 42.332-52.165 42.332-28.761 0-52.164-18.99-52.164-42.332 0-20.926 18.558-38.451 43.626-41.765 1.699-0.366 4.011-1.12 4.596-2.572 0.526-1.319 0.344-3.385 0.168-4.717 0 0-0.612-3.681-0.744-4.465-0.227-1.319-1.048-5.158 4.518-2.812 5.568 2.346 30.042 17.689 40.986 30.286h-2e-3c7.56 8.29 11.181 16.703 11.181 26.045" fill="#fff"/></g><g transform="matrix(1.6639 0 0 1.6639 441.59 393.77)"><path d="m0 0h-3.659c-0.561 0-1.017-0.455-1.017-1.014v-22.73c0-0.56 0.456-1.014 1.017-1.014h3.659c0.561 0 1.016 0.454 1.016 1.014v22.73c0 0.559-0.455 1.014-1.016 1.014" fill="#00b900"/></g><g transform="matrix(1.6639 0 0 1.6639 483.5 393.77)"><path d="m0 0h-3.659c-0.561 0-1.016-0.455-1.016-1.014v-13.504l-10.416 14.067c-0.024 0.036-0.051 0.07-0.079 0.103l-7e-3 6e-3c-0.02 0.023-0.04 0.043-0.061 0.063-6e-3 6e-3 -0.012 0.011-0.019 0.017-0.017 0.016-0.035 0.031-0.054 0.045-8e-3 8e-3 -0.017 0.014-0.026 0.021-0.018 0.012-0.035 0.025-0.053 0.036-0.01 7e-3 -0.02 0.013-0.031 0.018-0.018 0.011-0.036 0.022-0.054 0.031-0.011 5e-3 -0.021 0.011-0.032 0.015-0.019 9e-3 -0.038 0.018-0.058 0.025-0.012 4e-3 -0.022 8e-3 -0.033 0.012-0.02 7e-3 -0.04 0.014-0.061 0.019-0.011 4e-3 -0.023 6e-3 -0.035 0.01-0.02 4e-3 -0.039 9e-3 -0.058 0.013-0.014 2e-3 -0.029 4e-3 -0.043 5e-3 -0.018 4e-3 -0.036 5e-3 -0.054 7e-3 -0.017 2e-3 -0.034 2e-3 -0.052 3e-3 -0.013 0-0.023 2e-3 -0.036 2e-3h-3.658c-0.561 0-1.017-0.455-1.017-1.014v-22.73c0-0.56 0.456-1.014 1.017-1.014h3.658c0.562 0 1.017 0.454 1.017 1.014v13.5l10.429-14.085c0.072-0.102 0.161-0.185 0.258-0.251 3e-3 -2e-3 7e-3 -5e-3 0.01-8e-3 0.021-0.013 0.042-0.026 0.063-0.038 0.01-6e-3 0.019-0.01 0.029-0.015 0.015-9e-3 0.032-0.017 0.048-0.024 0.017-7e-3 0.032-0.014 0.05-0.021 0.01-4e-3 0.02-8e-3 0.03-0.011 0.024-9e-3 0.046-0.016 0.069-0.023 5e-3 0 0.01-2e-3 0.015-3e-3 0.083-0.022 0.17-0.035 0.26-0.035h3.659c0.562 0 1.016 0.454 1.016 1.014v22.73c0 0.559-0.454 1.014-1.016 1.014" fill="#00b900"/></g><g transform="matrix(1.6639 0 0 1.6639 426.92 362.04)"><path d="m0 0h-9.942v18.051c0 0.561-0.455 1.016-1.015 1.016h-3.66c-0.561 0-1.016-0.455-1.016-1.016v-22.726-2e-3c0-0.273 0.109-0.52 0.284-0.702 4e-3 -5e-3 8e-3 -0.01 0.014-0.015 5e-3 -5e-3 0.01-9e-3 0.015-0.014 0.183-0.176 0.429-0.284 0.702-0.284h1e-3 14.617c0.561 0 1.014 0.456 1.014 1.017v3.659c0 0.561-0.453 1.016-1.014 1.016" fill="#00b900"/></g><g transform="matrix(1.6639 0 0 1.6639 517.12 384.3)"><path d="m0 0c0.561 0 1.014 0.454 1.014 1.016v3.659c0 0.561-0.453 1.017-1.014 1.017h-14.617-2e-3c-0.274 0-0.521-0.11-0.704-0.287-4e-3 -4e-3 -9e-3 -7e-3 -0.012-0.011-6e-3 -6e-3 -0.011-0.012-0.016-0.018-0.174-0.182-0.282-0.428-0.282-0.7v-1e-3 -22.726-1e-3c0-0.273 0.109-0.52 0.284-0.702 4e-3 -5e-3 9e-3 -0.011 0.014-0.015 4e-3 -5e-3 0.01-0.01 0.015-0.014 0.182-0.175 0.429-0.284 0.701-0.284h2e-3 14.617c0.561 0 1.014 0.456 1.014 1.016v3.66c0 0.56-0.453 1.016-1.014 1.016h-9.941v3.842h9.941c0.561 0 1.014 0.455 1.014 1.016v3.659c0 0.561-0.453 1.017-1.014 1.017h-9.941v3.841h9.941z" fill="#00b900"/></g></g></g></svg>',
      // %0D%0A newline
      'share_url' => 'line://msg/text?[rrssb:title]%0D%0A%0D%0A[rrssb:url]',
      'color' => '#00c300',
      'color_hover' => '#00aa00',
      'popup' => FALSE,
    ),
  );

  return $buttons;
}
💬 Support request
Status

Fixed

Version

2.0

Component

Documentation

Created by

🇯🇵Japan ptmkenny

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇬🇧United Kingdom adamps

    The SVG file is processed in rrssb_calc_css(). If you look at how your SVG comes out of this, then I guess you can see what the problem is. The SVG files used in the module are very simple, just one path. Yours seems very complex in comparison, so it may not work with the current code.

    The workaround in #2 loses some of the performance benefits of this module - if forces an extra load of a separate SVG file, whereas the module puts the SVG into the CSS file which is then aggregated and cached.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024