tags using bitmaps as source */ class BitmapIconProvider implements IconProviderInterface { public const MARKUP_IDENTIFIER_INLINE = 'inline'; public function prepareIconMarkup(Icon $icon, array $options = []) { $icon->setMarkup($this->generateMarkup($icon, $options)); $icon->setAlternativeMarkup(self::MARKUP_IDENTIFIER_INLINE, $this->generateInlineMarkup($icon, $options)); } /** * @return string * @throws \InvalidArgumentException */ protected function generateMarkup(Icon $icon, array $options) { if (empty($options['source'])) { throw new \InvalidArgumentException('[' . $icon->getIdentifier() . '] The option "source" is required and must not be empty', 1440754980); } $source = $options['source']; return ''; } /** * Calculate public path of image file */ protected function getPublicPath(string $source): string { return (string)PathUtility::getSystemResourceUri($source); } /** * @return string * @throws \InvalidArgumentException */ protected function generateInlineMarkup(Icon $icon, array $options) { if (empty($options['source'])) { throw new \InvalidArgumentException('The option "source" is required and must not be empty', 1471460676); } $source = $options['source']; $filePath = PathUtility::isAbsolutePath($source) ? $source : GeneralUtility::getFileAbsFileName($source); if (!file_exists($filePath)) { return ''; } return sprintf( '', $icon->getDimension()->getWidth(), $icon->getDimension()->getHeight(), $this->getPublicPath($source) ); } }