code: public static function getPath($template, $format, $custom='templates')
  	{
  		$file = $template . '.' . $format;
  		$rootDir = System::getContainer()->getParameter('kernel.project_dir');
  
  		// Check the theme folder first
  		if (file_exists($rootDir . '/' . $custom . '/' . $file))
  		{
  			return $rootDir . '/' . $custom . '/' . $file;
  		}
  
  		// Then check the global templates directory (see #5547)
  		if ($custom != 'templates')
  		{
  			if (file_exists($rootDir . '/templates/' . $file))
  			{
  				return $rootDir . '/templates/' . $file;
  			}
  		}
  
  		return static::getDefaultPath($template, $format);
  	}
docs: Return a template path
  
  @param string $template The template name
  @param string $format   The output format (e.g. "html5")
  @param string $custom   The custom templates folder (defaults to "templates")
  
  @return string The path to the template file