Ubiquity 2.5.2
php rapid development framework
Loading...
Searching...
No Matches
Twig Class Reference

Ubiquity Twig template engine. More...

+ Inheritance diagram for Twig:

Public Member Functions

 __construct ($options=[])
 
 addFunction (string $name, $callback, array $options=[])
 
 render (string $viewName, ?array $pData=[], bool $asString=false)
 Renders a view.
 
 getBlockNames (string $templateName)
 {Returns the defined block names.
Parameters
string$templateName
}
 
 getCode (string $templateName)
 {Returns the source code of the template.
Parameters
string$templateName
}
 
 addPath (string $path, string $namespace)
 Adds a new path in a namespace.
 
 setPaths (array $paths, string $namespace)
 Sets a path in a namespace.
 
 setTheme (string $theme, string $themeFolder=ThemesManager::THEMES_FOLDER)
 
 exists (string $name)
 Checks if we have the source code of a template, given its name.
 
 getGenerator ()
 
- Public Member Functions inherited from TemplateEngine
 generateTemplateSourceFromFile (string $templateName)
 Generates the source for this engine from a twig model template.
 
 generateTemplateSource (string $source)
 

Protected Member Functions

 addFunctions ()
 
 addFilter (string $name, $callback, array $options=[])
 
 addExtension ($extension)
 
- Protected Member Functions inherited from TemplateEngine
 hasThemeResource (&$resource)
 
 safeString (string $str)
 

Private Attributes

 $twig
 
 $loader
 

Additional Inherited Members

- Protected Attributes inherited from TemplateEngine
Framework $fw
 

Detailed Description

Ubiquity Twig template engine.

Ubiquity\views\engine$Twig This class is part of Ubiquity

Author
jcheron myadd.nosp@m.ress.nosp@m.mail@.nosp@m.gmai.nosp@m.l.com
Version
1.0.13

Definition at line 31 of file Twig.php.

Constructor & Destructor Documentation

◆ __construct()

__construct (   $options = [])

Definition at line 35 of file Twig.php.

Member Function Documentation

◆ addExtension()

addExtension (   $extension)
protected

Reimplemented from TemplateEngine.

Definition at line 92 of file Twig.php.

◆ addFilter()

addFilter ( string  $name,
  $callback,
array  $options = [] 
)
protected
Parameters
string$name
$callback
array$options
Returns
void

Reimplemented from TemplateEngine.

Definition at line 88 of file Twig.php.

◆ addFunction()

addFunction ( string  $name,
  $callback,
array  $options = [] 
)
Parameters
string$name
$callback
array$options
Returns
void

Reimplemented from TemplateEngine.

Definition at line 84 of file Twig.php.

◆ addFunctions()

addFunctions ( )
protected

Reimplemented from TemplateEngine.

Definition at line 63 of file Twig.php.

◆ addPath()

addPath ( string  $path,
string  $namespace 
)

Adds a new path in a namespace.

Parameters
string$pathThe path to add
string$namespaceThe namespace to use

Definition at line 141 of file Twig.php.

◆ exists()

exists ( string  $name)

Checks if we have the source code of a template, given its name.

Parameters
string$name
Returns
boolean

Reimplemented from TemplateEngine.

Definition at line 173 of file Twig.php.

◆ getBlockNames()

getBlockNames ( string  $templateName)

{Returns the defined block names.

Parameters
string$templateName
}

See also
\Ubiquity\views\engine\TemplateEngine::getBlockNames()

Reimplemented from TemplateEngine.

Definition at line 117 of file Twig.php.

◆ getCode()

getCode ( string  $templateName)

{Returns the source code of the template.

Parameters
string$templateName
}

See also
\Ubiquity\views\engine\TemplateEngine::getCode()

Reimplemented from TemplateEngine.

Definition at line 131 of file Twig.php.

◆ getGenerator()

getGenerator ( )

Reimplemented from TemplateEngine.

Definition at line 177 of file Twig.php.

◆ render()

render ( string  $viewName,
?array  $pData = [],
bool  $asString = false 
)

Renders a view.

Parameters
string$viewName
array | null$pData
boolean$asString

Reimplemented from TemplateEngine.

Definition at line 100 of file Twig.php.

◆ setPaths()

setPaths ( array  $paths,
string  $namespace 
)

Sets a path in a namespace.

Parameters
array$pathsThe paths to add
string$namespaceThe namespace to use

Definition at line 151 of file Twig.php.

◆ setTheme()

setTheme ( string  $theme,
string  $themeFolder = ThemesManager::THEMES_FOLDER 
)
Parameters
string$theme
string$themeFolder
Returns
string|void
Exceptions
ThemesException

Reimplemented from TemplateEngine.

Definition at line 161 of file Twig.php.

Field Documentation

◆ $loader

$loader
private

Definition at line 33 of file Twig.php.

◆ $twig

$twig
private

Definition at line 32 of file Twig.php.


The documentation for this class was generated from the following file: