public function getIconForExtension($extension = null) {
		$extension = mb_strtolower((string)$extension);
		$cachePath = 'IconForExtension.' . md5($extension);
		$cached = Cache::read($cachePath, CAKE_THEME_CACHE_KEY_HELPERS);
		if (!empty($cached)) {
			return $cached;
		}

		$result = 'far fa-file';
		if (empty($extension)) {
			Cache::write($cachePath, $result, CAKE_THEME_CACHE_KEY_HELPERS);

			return $result;
		}

		$extensions = [
			'far fa-file-archive' => ['zip', 'rar', '7z'],
			'far fa-file-word' => ['doc', 'docx'],
			'far fa-file-code' => ['htm', 'html', 'xml', 'js'],
			'far fa-file-image' => ['jpg', 'jpeg', 'png', 'gif'],
			'far fa-file-pdf' => ['pdf'],
			'far fa-file-video' => ['avi', 'mp4'],
			'far fa-file-powerpoint' => ['ppt', 'pptx'],
			'far fa-file-audio' => ['mp3', 'wav', 'flac'],
			'far fa-file-excel' => ['xls', 'xlsx'],
			'far fa-file-alt' => ['txt'],
		];

		foreach ($extensions as $icon => $extensionsList) {
			if (in_array($extension, $extensionsList)) {
				$result = $icon;
				break;
			}
		}
		Cache::write($cachePath, $result, CAKE_THEME_CACHE_KEY_HELPERS);

		return $result;
	}
public function getIconForExtension($extension = null) {
		$extension = mb_strtolower((string)$extension);
		$cachePath = 'IconForExtension.' . md5($extension);
		$cached = Cache::read($cachePath, CAKE_THEME_CACHE_KEY_HELPERS);
		if (!empty($cached)) {
			return $cached;
		}

		$result = 'far fa-file';
		if (empty($extension)) {
			Cache::write($cachePath, $result, CAKE_THEME_CACHE_KEY_HELPERS);

			return $result;
		}

		$extensions = [
			'far fa-file-archive' => ['zip', 'rar', '7z'],
			'far fa-file-word' => ['doc', 'docx'],
			'far fa-file-code' => ['htm', 'html', 'xml', 'js'],
			'far fa-file-image' => ['jpg', 'jpeg', 'png', 'gif'],
			'far fa-file-pdf' => ['pdf'],
			'far fa-file-video' => ['avi', 'mp4'],
			'far fa-file-powerpoint' => ['ppt', 'pptx'],
			'far fa-file-audio' => ['mp3', 'wav', 'flac'],
			'far fa-file-excel' => ['xls', 'xlsx'],
			'far fa-file-alt' => ['txt'],
		];

		foreach ($extensions as $icon => $extensionsList) {
			if (in_array($extension, $extensionsList)) {
				$result = $icon;
				break;
			}
		}
		Cache::write($cachePath, $result, CAKE_THEME_CACHE_KEY_HELPERS);

		return $result;
	}
public function getIconForExtension ( $ extension = null ) { $ extension = mb_strtolower ( ( string ) $ extension ) ; $ cachePath = 'IconForExtension.' . md5 ( $ extension ) ; $ cached = Cache :: read ( $ cachePath , CAKE_THEME_CACHE_KEY_HELPERS ) ; if ( ! empty ( $ cached ) ) { return $ cached ; } $ result = 'far fa-file' ; if ( empty ( $ extension ) ) { Cache :: write ( $ cachePath , $ result , CAKE_THEME_CACHE_KEY_HELPERS ) ; return $ result ; } $ extensions = [ 'far fa-file-archive' => [ 'zip' , 'rar' , '7z' ] , 'far fa-file-word' => [ 'doc' , 'docx' ] , 'far fa-file-code' => [ 'htm' , 'html' , 'xml' , 'js' ] , 'far fa-file-image' => [ 'jpg' , 'jpeg' , 'png' , 'gif' ] , 'far fa-file-pdf' => [ 'pdf' ] , 'far fa-file-video' => [ 'avi' , 'mp4' ] , 'far fa-file-powerpoint' => [ 'ppt' , 'pptx' ] , 'far fa-file-audio' => [ 'mp3' , 'wav' , 'flac' ] , 'far fa-file-excel' => [ 'xls' , 'xlsx' ] , 'far fa-file-alt' => [ 'txt' ] , ] ; foreach ( $ extensions as $ icon => $ extensionsList ) { if ( in_array ( $ extension , $ extensionsList ) ) { $ result = $ icon ; break ; } } Cache :: write ( $ cachePath , $ result , CAKE_THEME_CACHE_KEY_HELPERS ) ; return $ result ; }
Return icon for file from extension.

@param string $extension Extension of file
@return string Icon for file.
@link http://fontawesome.io
Return icon for file from extension .