File tree Expand file tree Collapse file tree
app/sprinkles/core/src/ServicesProvider Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -689,24 +689,17 @@ public function register(ContainerInterface $container)
689689 * @return \Slim\Views\Twig
690690 */
691691 $ container ['view ' ] = function ($ c ) {
692- $ templatePaths = $ c ->locator ->findResources ('templates:// ' , true , false );
693692
694- $ view = new Twig ($ templatePaths );
693+ /** @var \UserFrosting\UniformResourceLocator\ResourceLocator $locator */
694+ $ locator = $ c ->locator ;
695695
696+ $ templatePaths = $ locator ->getResources ('templates:// ' );
697+ $ view = new Twig ($ templatePaths );
696698 $ loader = $ view ->getLoader ();
697699
698- $ sprinkles = $ c ->sprinkleManager ->getSprinkleNames ();
699-
700700 // Add Sprinkles' templates namespaces
701- // TODO : Use locator
702- foreach ($ sprinkles as $ sprinkle ) {
703- $ path = \UserFrosting \APP_DIR . \UserFrosting \DS . \UserFrosting \SPRINKLES_DIR_NAME . \UserFrosting \DS .
704- $ sprinkle . \UserFrosting \DS .
705- \UserFrosting \TEMPLATE_DIR_NAME . \UserFrosting \DS ;
706-
707- if (is_dir ($ path )) {
708- $ loader ->addPath ($ path , $ sprinkle );
709- }
701+ foreach (array_reverse ($ templatePaths ) as $ templateResource ) {
702+ $ loader ->addPath ($ templateResource ->getAbsolutePath (), $ templateResource ->getLocation ()->getName ());
710703 }
711704
712705 $ twig = $ view ->getEnvironment ();
You can’t perform that action at this time.
0 commit comments