* @copyright Meritoo.pl */ class Bundle { /** * Returns path to view / template of given bundle * * @param string $viewPath Path of the view / template, e.g. "MyDirectory/my-template" * @param string $bundleName Name of the bundle, e.g. "MyExtraBundle" * @param string $extension (optional) Extension of the view / template * @return string|null */ public static function getBundleViewPath($viewPath, $bundleName, $extension = 'html.twig') { /* * Unknown path, extension of the view / template or name of the bundle? * Nothing to do */ if (empty($viewPath) || empty($bundleName) || empty($extension)) { return null; } /* * Path of the view / template doesn't end with given extension? */ if (!Regex::endsWith($viewPath, $extension)) { $viewPath = sprintf('%s.%s', $viewPath, $extension); } return sprintf('%s:%s', $bundleName, $viewPath); } }