public static function getTemplates($template, $format = 'html5')
	{
		$templates = array();

		try {
			$theme = \ThemeModel::findAll(array('order'=>'name'));
		}
		catch (\Exception $e) {
			$theme = null;
		}

		while ($theme && $theme->next()) {
			if ($theme->templates != '') {
				if (file_exists(TL_ROOT . '/' . $theme->templates . '/' . $template . '.' . $format)) {
					$templates[] = TL_ROOT . '/' . $theme->templates . '/' . $template . '.' . $format;
				}
			}
		}

		if (file_exists(TL_ROOT . '/templates/' . $template . '.' . $format)) {
			$templates[] = TL_ROOT . '/templates/' . $template . '.' . $format;
		}

		// Add templates of inactive themes to the bottom of the templates array
		$allFiles = glob(TL_ROOT . '/templates/*/' . $template . '.' . $format) ?: array();
		foreach ($allFiles as $file) {
			if (!in_array($file, $templates)) {
				$templates[] = $file;
			}
		}

		if (count($templates)) {
			return $templates;
		}

		return array(parent::getTemplate($template, $format));
	}