アイコンを取得する

@param   mixed   $icon

@return  string
422465
public static function getIconName($icon){
        $icon   = is_scalar($icon) ? $icon : self::ICON_NULL;
        
        return self::ICON_NAMES[$icon] ?? self::ICON_NAMES[self::ICON_NULL];
    }
862912
public static function icon($icon, $htmlOptions = array(), $tagName = 'i')
    {
        if (is_string($icon)) {
            if (strpos($icon, 'foundicon-') === false) {
                $icon = 'foundicon-' . implode(' foundicon-', array_unique(explode(' ', $icon)));
            }
            ArrayHelper::addValue('class', $icon, $htmlOptions);
            return \CHtml::openTag($tagName, $htmlOptions) . \CHtml::closeTag($tagName);
        }
        return '';
    }
498829
protected function materialDesignIconicFontIcon(MaterialDesignIconicFontIconInterface $icon) {

        $attributes = [];

        $attributes["class"][] = "zmdi";
        $attributes["class"][] = MaterialDesignIconicFontIconRenderer::renderName($icon);
        $attributes["class"][] = MaterialDesignIconicFontIconRenderer::renderSize($icon);
        $attributes["class"][] = MaterialDesignIconicFontIconRenderer::renderFixedWidth($icon);
        $attributes["class"][] = MaterialDesignIconicFontIconRenderer::renderBorder($icon);
        $attributes["class"][] = MaterialDesignIconicFontIconRenderer::renderPull($icon);
        $attributes["class"][] = MaterialDesignIconicFontIconRenderer::renderSpin($icon);
        $attributes["class"][] = MaterialDesignIconicFontIconRenderer::renderRotate($icon);
        $attributes["class"][] = MaterialDesignIconicFontIconRenderer::renderFlip($icon);
        $attributes["style"]   = MaterialDesignIconicFontIconRenderer::renderStyle($icon);

        return static::coreHTMLElement("i", null, $attributes);
    }
668718
protected function getIconCssClasses(?string $icon = null, bool $animated = false, array $cssClasses = [])
    {
        $cssClasses[] = 'fa';
        $cssClasses[] = $icon ?? $this->getIcon();
        if ($animated === true) {
            if ($this->getIcon() === 'fa-spinner') {
                $cssClasses[] = 'fa-pulse';
            } else if (in_array($this->getIcon(), ['fa-spinner', 'fa-circle-o-notch', 'fa-refresh', 'fa-cog'])) {
                $cssClasses[] = 'fa-spin';
            }
        }
        if ($this->iconColor) {
            $cssClasses[] = 'text-' . $this->iconColor;
        }
        return $cssClasses;
    }
919987
public function getIcon()
    {
        $filename = $this->getFilename();
        $ext = pathinfo($filename, PATHINFO_EXTENSION);
        return File::get_icon_for_extension($ext);
    }
818265
public function render(IconSequence $icon)
    {
        $jsonBuilder = $this->getJsonBuilder()
            ->setValue('[icon]', $icon->getSymbol()->getVariable(), false)
            ->setValues($icon->getOptions());

        return $this->getFormatter()->renderObjectAssignment($icon, $jsonBuilder->build());
    }
1031734
public function getIcon($default = null)
    {
        if ($this->icon !== null && $this->icon !== '') {
            return '<i class="' . $this->icon . '"></i>';
        }
        if ($default === null) {
            return $default;
        }

        return '<i class="' . $default . '"></i>';
    }
476118
protected function generateMarkup(Icon $icon, array $options)
    {

        $previewIconAvailable = $this->isPreviewIconAvailable($options['contentElementKey']);
        $fontAwesomeKeyAvailable = $this->isFontAwesomeKeyAvailable($this->contentElement);


        // decide what kind of icon to render
        if ($fontAwesomeKeyAvailable) {

            $color = $this->getColor($this->contentElement);
            if ($color) {
                $styles[] = "color: #" . $color;
            }
            if (count($styles)) {
                $markup = '<span class="icon-unify" style="' . implode("; ",
                        $styles) . '"><i class="fa fa-' . htmlspecialchars($this->getFontAwesomeKey($this->contentElement)) . '"></i></span>';
            } else {
                $markup = '<span class="icon-unify" ><i class="fa fa-' . htmlspecialchars($this->getFontAwesomeKey($this->contentElement)) . '"></i></span>';
            }
        } else {
            if ($previewIconAvailable) {
                $markup = '<img src="' . PathUtility::getAbsoluteWebPath(PATH_site . ltrim($this->getPreviewIconPath($options['contentElementKey']),
                            '/')) . '" alt="' . $this->contentElement["label"] . '" title="' . $this->contentElement["label"] . '"/>';
            } else {
                $color = $this->getColor($this->contentElement);
                if ($color) {
                    $styles[] = "background-color: #" . $color;
                }
                $styles[] = "color: #fff";
                $markup = '<span class="icon-unify mask-default-icon" style="' . implode("; ",
                        $styles) . '">' . mb_substr($this->contentElement["label"], 0, 1) . '</span>';
            }
        }

        return $markup;
    }
828360
public function icon($icon, array $options = [], array $attributes = []) {
		if (!$icon) {
			return '';
		}

		$defaults = [
			'translate' => true,
		];
		$options += $defaults;

		$type = $icon;
		if ($this->getConfig('autoPrefix') && empty($options['iconNamespace'])) {
			$namespace = $this->detectNamespace($icon);
			if ($namespace) {
				$options['iconNamespace'] = $namespace;
				$options['autoPrefix'] = false;
				$icon = substr($icon, strlen($namespace) + 1);
			}
		}

		if (!isset($attributes['title'])) {
			if (isset($options['title'])) {
				$attributes['title'] = $options['title'];
			} else {
				$attributes['title'] = Inflector::humanize($icon);
			}
		}

		return $this->_fontIcon($type, $options, $attributes);
	}
1186054
public function setIcon($icon)
    {
        $this->icon = $icon;

        $type = mb_substr($icon, 0, 1) === ':' && mb_substr($icon, -1) === ':'
            ? 'iconEmoji'
            : 'iconUrl';

        $this->$type = $icon;

        return $this;
    }
325013
public function getIcons($activity)
    {
        $icon['location_icon'] = $this->twigExt->mediumIcon($activity->getLocation());
        $icon['activity_icon'] = '/'.$this->twigExt->mediumContext($activity->getLocation());

        return $icon;
    }
327594
private function resolveIcon(string $identifier): string
    {
        $config = null;

        $parameterName = $this->getConfigParameterName($identifier);
        if ($this->configResolver->hasParameter($parameterName)) {
            $config = $this->configResolver->getParameter($parameterName);
        }

        if ($config === null || empty($config[self::ICON_KEY])) {
            $config = $this->configResolver->getParameter(
                $this->getConfigParameterName(self::DEFAULT_IDENTIFIER)
            );
        }

        return $config[self::ICON_KEY];
    }
438244
public function setIcon( $icon = null ) {
		if ( $this->iconName !== null ) {
			$this->icon->removeClasses( [ 'oo-ui-icon-' . $this->iconName ] );
		}
		if ( $icon !== null ) {
			$this->icon->addClasses( [ 'oo-ui-icon-' . $icon ] );
		}

		$this->iconName = $icon;
		$this->toggleClasses( [ 'oo-ui-iconElement' ], (bool)$this->iconName );
		$this->icon->toggleClasses( [ 'oo-ui-iconElement-noIcon' ], !$this->iconName );

		return $this;
	}
578532
protected function render_pix_icon(pix_icon $icon) {
        $system = \core\output\icon_system::instance();
        return $system->render_pix_icon($this, $icon);
    }
1034679
public function getIcon()
    {
        if (!$this->icon) {
            return "";
        }
        return Html::get()->image($this->icon, $this->translate($this->label));
    }
944012
public function setIcon($icon)
    {
        switch ($icon) {
            case 'info':
            case 'error':
            case 'warning':
                $this->icon = $icon;
                break;
            default:
                if (file_exists($icon) && is_file($icon)) {
                    $this->icon = $icon;
                } else {
                    if (isset($this->log)) {
                        $this->log(
                            sprintf(
                                "%s is not a file. Using default icon instead.",
                                $icon
                            ),
                            Project::MSG_WARN
                        );
                    }
                }
        }
    }
1069082
public function addonIcon($icon, $options = [])
    {
        $prefix = array_get($options, 'prefix', $this->getIconPrefix());

        return '<div class="input-group-addon"><span ' . $this->html->attributes($options) . '><i class="'.$prefix.$icon.'"></i></span></div>';
    }