src/PatternLab/PatternEngine/Twig/TwigUtil.php
public static function loadMacros() {
		
		// load defaults
		$macroDir = Config::getOption("sourceDir").DIRECTORY_SEPARATOR."_macros";
		$macroExt = Config::getOption("twigMacroExt");
		$macroExt = $macroExt ? $macroExt : "macro.twig";
		
		if (is_dir($macroDir)) {
			
			// loop through some macro containing dir and run...
			$finder = new Finder();
			$finder->files()->name("*.".$macroExt)->in($macroDir);
			$finder->sortByName();
			foreach ($finder as $file) {
				
				// see if the file should be ignored
				$baseName = $file->getBasename();
				if ($baseName[0] != "_") {
					
					// add the macro to the global context
					self::$instance->addGlobal($file->getBasename(".".$macroExt), self::$instance->loadTemplate($baseName));
					
				}
				
			}
			
		}
		
	}
public static function loadMacros() {
		
		// load defaults
		$macroDir = Config::getOption("sourceDir").DIRECTORY_SEPARATOR."_macros";
		$macroExt = Config::getOption("twigMacroExt");
		$macroExt = $macroExt ? $macroExt : "macro.twig";
		
		if (is_dir($macroDir)) {
			
			// loop through some macro containing dir and run...
			$finder = new Finder();
			$finder->files()->name("*.".$macroExt)->in($macroDir);
			$finder->sortByName();
			foreach ($finder as $file) {
				
				// see if the file should be ignored
				$baseName = $file->getBasename();
				if ($baseName[0] != "_") {
					
					// add the macro to the global context
					self::$instance->addGlobal($file->getBasename(".".$macroExt), self::$instance->loadTemplate($baseName));
					
				}
				
			}
			
		}
		
	}
public static function loadMacros ( ) { // load defaults $ macroDir = Config :: getOption ( "sourceDir" ) . DIRECTORY_SEPARATOR . "_macros" ; $ macroExt = Config :: getOption ( "twigMacroExt" ) ; $ macroExt = $ macroExt ? $ macroExt : "macro.twig" ; if ( is_dir ( $ macroDir ) ) { // loop through some macro containing dir and run... $ finder = new Finder ( ) ; $ finder -> files ( ) -> name ( "*." . $ macroExt ) -> in ( $ macroDir ) ; $ finder -> sortByName ( ) ; foreach ( $ finder as $ file ) { // see if the file should be ignored $ baseName = $ file -> getBasename ( ) ; if ( $ baseName [ 0 ] != "_" ) { // add the macro to the global context self :: $ instance -> addGlobal ( $ file -> getBasename ( "." . $ macroExt ) , self :: $ instance -> loadTemplate ( $ baseName ) ) ; } } } }
Load macros for the Twig PatternEngine
Load macros for the Twig PatternEngine