function SvgExtractor::loadIcon

Overrides IconExtractorBase::loadIcon

File

core/lib/Drupal/Core/Theme/Plugin/IconExtractor/SvgExtractor.php, line 78

Class

SvgExtractor
Plugin implementation of the icon_extractor.

Namespace

Drupal\Core\Theme\Plugin\IconExtractor

Code

public function loadIcon(array $icon_data) : ?IconDefinitionInterface {
    if (!isset($icon_data['icon_id']) || !isset($icon_data['source']) || !isset($icon_data['absolute_path'])) {
        return NULL;
    }
    if (!($svg_data = $this->extractSvg($icon_data['absolute_path']))) {
        return NULL;
    }
    return $this->createIcon($icon_data['icon_id'], $icon_data['source'], $icon_data['group'] ?? NULL, $svg_data);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.