Skip to content

SVG_Icons

linchpin edited this page Jun 2, 2023 · 4 revisions

SVG_Icons

This class is in charge of displaying SVG icons across the site.

Place each source on its own array key, without adding either the width or height attributes, since these are added dynamically, before rendering the SVG code.

All icons are assumed to have equal width and height, hence the option to only specify a $size parameter in the svg methods.

  • Full name: \SVG_Icons

Properties

icons

User Interface icons – svg sources.

protected static array $icons
  • This property is static.

social_icons

Social Icons – svg sources.

protected static array $social_icons
  • This property is static.

social_icons_map

Social Icons – domain mappings.

protected static array $social_icons_map

By default, each Icon ID is matched against a .com TLD. To override this behavior, specify all the domains it covers (including the .com TLD too, if applicable).

  • This property is static.

Methods

get_svg

Gets the SVG code for a given icon.

public static get_svg(string $group, string $icon, int $size): string
  • This method is static.

Parameters:

Parameter Type Description
$group string the icon group.
$icon string The icon.
$size int The icon-size in pixels.

get_social_link_svg

Detects the social network from a URL and returns the SVG code for its icon.

public static get_social_link_svg(string $uri, int $size): string|null
  • This method is static.

Parameters:

Parameter Type Description
$uri string Social link.
$size int The icon-size in pixels.


Automatically generated from source code comments on 2023-06-02 using phpDocumentor and saggre/phpdocumentor-markdown

Clone this wiki locally