Get asset path.

@param string $icon
@param array  $params

@return string
517624
public function getAssetPath($icon, array $params = [])
    {
        $overlay = [];

        if (!empty($params['status'])) {
            $overlay['status'] = $params['status'];
        }

        if (!empty($params['timer'])) {
            $overlay['timer'] = $params['timer'];
        }

        if (!empty($params['lock'])) {
            $overlay['lock'] = $params['lock'];
        }

        if (!empty($params['instance'])) {
            $overlay['instance'] = $params['instance'];
        }

        if (!empty($params['sort'])) {
            $overlay['sort'] = $params['sort'];
        }

        $fallback = $this->locator->locate('@PhlexibleElementtypeBundle/Resources/public/elementtypes/icon_notfound.gif');

        if ($icon === null) {
            $filename = $fallback;
        } else {
            $prefix = '@PhlexibleElementtypeBundle/Resources/public/elementtypes/';
            $filename = $this->locator->locate($prefix.$icon);

            if (!file_exists($filename)) {
                $filename = $fallback;
            }
        }

        $cacheFilename = $this->cacheDir.'/'.md5(basename($filename).'__'.implode('__', $overlay)).'.png';

        if (!file_exists($cacheFilename) || (time() - filemtime($cacheFilename)) > 60 * 60 * 24 * 30) {
            $target = imagecreate(18, 18);
            $black = imagecolorallocate($target, 0, 0, 0);
            imagecolortransparent($target, $black);

            $iconSource = imagecreatefromgif($filename);
            imagecopy($target, $iconSource, 0, 0, 0, 0, 18, 18);
            imagedestroy($iconSource);

            $overlayDir = '@PhlexibleElementBundle/Resources/public/overlays/';

            if (!empty($overlay['status'])) {
                // apply status overlay
                $overlayIcon = imagecreatefromgif(
                    $this->locator->locate($overlayDir.'status_'.$overlay['status'].'.gif')
                );
                imagecopy($target, $overlayIcon, 9, 9, 0, 0, 8, 8);
                imagedestroy($overlayIcon);
            }

            if (!empty($overlay['timer'])) {
                // apply timer overlay
                $overlayIcon = imagecreatefromgif(
                    $this->locator->locate($overlayDir.'timer.gif')
                );
                imagecopy($target, $overlayIcon, 10, 0, 0, 0, 8, 8);
                imagedestroy($overlayIcon);
            }

            if (!empty($overlay['sort'])) {
                // apply timer overlay
                $overlayIcon = imagecreatefromgif(
                    $this->locator->locate($overlayDir.'sort_'.$overlay['sort'].'.gif')
                );
                imagecopy($target, $overlayIcon, 10, 0, 0, 0, 8, 8);
                imagedestroy($overlayIcon);
            }

            if (!empty($overlay['instance'])) {
                // apply alias overlay
                $overlayIcon = imagecreatefromgif(
                    $this->locator->locate($overlayDir.'instance_'.$overlay['instance'].'.gif')
                );
                imagecopy($target, $overlayIcon, 0, 10, 0, 0, 8, 8);
                imagedestroy($overlayIcon);
            }

            if (!empty($overlay['lock'])) {
                // apply lock overlay
                $overlayIcon = imagecreatefromgif(
                    $this->locator->locate($overlayDir.'lock_'.$overlay['lock'].'.gif')
                );
                imagecopy($target, $overlayIcon, 0, 0, 0, 0, 8, 8);
                imagedestroy($overlayIcon);
            }

            if (!file_exists($this->cacheDir)) {
                mkdir($this->cacheDir, 0777, true);
            }

            imagepng($target, $cacheFilename);
        }

        return $cacheFilename;
    }
450635
public function getIcon($title, Table $table) {
        if ($this->icon) {
            $icon = str_replace(array('%DATATABLE_ASSETS%', '%SIZE%'), array($table->getAssetsURL(), $this->iconSize . 'x' . $this->iconSize), $this->icon);
            if ('%MPF_ASSETS%' == substr($icon, 0, 12)) {
                $icon = AssetsPublisher::get()->mpfAssetFile(substr($icon, 12));
            }
            return Html::get()->image($icon, $title);
        }
        return '';
    }
48563
public function getIcon(string $path, $class) : string
    {
        if (file_exists($path . '/assets/icon.svg')) {
            return file_get_contents($path . '/assets/icon.svg');
        }

        // If fail to load (may happen on some systems) TODO: Make this more fancy
        if (file_exists($path . preg_replace('/\s+/', '', ucwords($class->nameSingular)). '/assets/icon.svg')) {
            return file_get_contents($path . preg_replace('/\s+/', '', ucwords($class->nameSingular)). '/assets/icon.svg');
        }

        return '';
    }
880283
public static function getAssetFilePaths($type)
    {
        $path = sprintf('%s/assets/%s/', __DIR__, $type);
        $filenames = preg_grep('/^[^\.]/', scandir($path));
        if (!Arr::iterable($filenames)) {
            return array();
        }

        return array_map(function ($filename) use ($path) {
            return $path.$filename;
        }, $filenames);
    }
578532
protected function render_pix_icon(pix_icon $icon) {
        $system = \core\output\icon_system::instance();
        return $system->render_pix_icon($this, $icon);
    }
77241
public function icon($icon = 'home', array $options = [])
    {
        $iconPref = $this->_configRead('iconPref');
        $_classes = [
            $this->_class(__FUNCTION__),
            $iconPref,
            $iconPref . '-' . $icon,
        ];

        $options = $this->_addClass($options, implode(' ', $_classes));
        $classes = $options['class'];
        unset($options['class']);

        $templater = $this->templater();
        return $templater->format(__FUNCTION__, [
            'class' => $classes,
            'attrs' => $templater->formatAttributes($options),
        ]);
    }
838043
public function countryIcon($icon, $returnFalseOnFailure = false, $options = [], $attr = []) {
		$ending = 'gif';
		$image = 'unknown';

		list($wwwPath, $path) = $this->getCountryIconPaths();

		if (!empty($options) && is_array($options)) {
			if (!empty($options['ending'])) {
				$ending = $options['ending'];
			}
		}

		$icon = mb_strtolower($icon);

		if (empty($icon)) {
			if ($returnFalseOnFailure) {
				return false;
			}
		} elseif (!file_exists($path . $icon . '.' . $ending)) {
			trigger_error($path . $icon . '.' . $ending . ' missing', E_USER_NOTICE);

			if ($returnFalseOnFailure) {
				return false;
			}
		} else {
			$image = $icon;
		}

		$defaults = ['alt' => $icon, 'title' => strtoupper($icon)];
		$attr += $defaults;

		return $this->Html->image($wwwPath . $image . '.' . $ending, $attr);
	}
471619
public static function icon($icon, $options = [])
    {
        Html::addCssClass($options, $icon . ' icon');
        return Html::tag(ArrayHelper::remove($options, 'tag', 'i'), '', $options);
    }
1064116
function fetch_remote_icon_url() {
            $info = $this->fetch_module_info();

            return ( $this->is_api_result_object( $info, 'icon' ) && is_string( $info->icon ) ) ?
                $info->icon :
                '';
        }
771194
public static function appIcons() {
    $config = Config::instance();
    $icons_directory = THEME_DIRECTORY.'/'.$config->app_icons_directory;
    $icons_url = THEME_URL.'/'.$config->app_icons_directory;
    if(!file_exists($icons_directory)) return null;
    
    $files = scandir($icons_directory);
    if(!Arr::iterable($files)) return null;
    
    // Icon files should start with one of these, and be delimited by hyphens
    $icon_types = ['apple', 'android', 'favicon'];
    $paths = [];
    
    foreach($files as $file)  {
      if(!preg_match('/\.png$/', $file)) continue;
      
      // Get size from image name
      preg_match('/(\d+x\d+)/', $file, $sizes);
      if(!Arr::iterable($sizes)) continue;
      
      $size = reset($sizes);
      $icon_type = reset(explode('-', $file));
      if(!in_array($icon_type, $icon_types)) continue;
      
      $file_path = $icons_url.'/'.$file;
      $paths[] = View::make('meta/icon-'.$icon_type, [
        'file' => $file_path,
        'size' => $size,
      ]);
    }
    
    $paths[] = View::make('meta/icon-favicon-ico', [
      'file' => $icons_url.'/favicon.ico',
    ]);
    return join('', $paths);
  }
17754
public static function getAssetUrl(string $path = '') : string
    {
        if (static::$assetUrl === null) {
            static::$assetUrl = FileHelper::getAssetUrl(static::className());
        }
        ;
        return static::$assetUrl . $path;
    }
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;
    }
506661
protected function setIcon($actions, $num = 1)
    {
        foreach ($actions as $key=>$moudel){
            if(isset($moudel['actions'])){
                $actions[$key]['iconClose'] = $this->request->root()."/apidoc/js/zTree_v3/img/zt-folder.png";
                $actions[$key]['iconOpen'] = $this->request->root()."/apidoc/js/zTree_v3/img/zt-folder-o.png";
                $actions[$key]['open'] = true;
                $actions[$key]['isParent'] = true;
                $actions[$key]['actions'] = $this->setIcon($moudel['actions'], $num = 1);
            }else{
                $actions[$key]['icon'] = $this->request->root()."/apidoc/js/zTree_v3/img/zt-file.png";
                $actions[$key]['isParent'] = false;
                $actions[$key]['isText'] = true;
            }
        }
        return $actions;
    }
428801
public static function createIcon(string $icon, array $arguments = null) {
		$element = Html::el("i");
		
		if($icon == "b" or $icon == "l" or $icon == "s" or $icon == "r") {
			// Markup of icon which use Font Awesome 5.
			$class = ["fa".$icon];
		} else {
			// Markup of icon which use Font Awesome 4.
			$class = ["fa fa-".$icon];
		}
		
		if(isset($arguments)) {
			foreach($arguments as $argument) {
				$class[] = "fa-".$argument;
			}
		}
		
		$element->addAttributes(["class" => $class, "aria-hidden" => "true"]);
		return $element;
	}
1247472
private function getAssetUrl($path)
    {
        $url = $this->assetsPackages->getUrl($path);
        if (!$url) {
            return $path;
        }

        /**
         * If `framework.assets.version: some_version` set, then $version = '?some_version'.
         * If `framework.assets: json_manifest_path` is used, then $version = '/'.
         */
        $version = $this->assetsPackages->getVersion($path);
        if (false === strpos($version, '?')) {
            return $url;
        }

        return preg_replace('/\?' . $version . '/', '', $url);
    }
12136
protected function _setIconOptions(array $options = [], array $iconOptions = [])
    {
        $icon = $options['icon'];
        if (Arr::key('iconInline', $options)) {
            $iconPrefix = $this->_configRead('iconPref');
            $options = $this->_addClass($options, implode(' ', [
                $this->_class('icon'),
                $iconPrefix,
                $iconPrefix . '-' . $icon
            ]));

            unset($options['icon']);
        } else {
            $options['escape'] = false;
            $iconOptions['createIcon'] = true;
        }

        return [$options, $iconOptions];
    }
782962
private function uriConstruct($slug, $params) {
		$uri = self::API_HOST . '/' . $slug;
		if ($params) {
			$queryData = http_build_query($params);
			$uri .= '?' . $queryData;
		}

		return $uri;
	}