Skip to content

Commit

Permalink
EWPP-1096: Update defaults to ECL V3.
Browse files Browse the repository at this point in the history
  • Loading branch information
imanoleguskiza committed May 6, 2021
1 parent 12990c7 commit b64a65b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Loader/EuropaComponentLibraryLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class EuropaComponentLibraryLoader extends \Twig_Loader_Filesystem
* @param string $extension
* Twig extension, defaults to ".html.twig".
*/
public function __construct($namespaces, $paths = [], $root = null, $prefix = 'ec-component-', $templatePrefix = 'ecl-', $extension = '.html.twig')
public function __construct($namespaces, $paths = [], $root = null, $prefix = 'twig-component-', $templatePrefix = '', $extension = '.html.twig')
{
parent::__construct($paths, $root);
$this->namespaces = $namespaces;
Expand Down Expand Up @@ -91,8 +91,13 @@ protected function findTemplate($name)
list($componentName, $templateName) = explode('/', $componentName);
$prefixedName = $this->normalizeComponentName($componentName);
}
$name = $prefixedName.DIRECTORY_SEPARATOR.$this->templatePrefix.$templateName.$this->extension;
$name = $prefixedName.DIRECTORY_SEPARATOR.$this->templatePrefix.$templateName;

// The component name could already include the file extension so check
// and add if it is not.
if (substr_compare($name, $this->extension, -strlen($this->extension)) !== 0) {
$name = $name.$this->extension;
}
return parent::findTemplate($name);
}

Expand Down

0 comments on commit b64a65b

Please sign in to comment.