Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
Mustache_Loader_FilesystemLoader Class Reference
Inheritance diagram for Mustache_Loader_FilesystemLoader:
Mustache_Loader Mustache_Loader_ProductionFilesystemLoader core\output\mustache_filesystem_loader

Public Member Functions

 __construct ($baseDir, array $options=array())
 Mustache filesystem Loader constructor.
 
 load ($name)
 Load a Template by name.
 

Protected Member Functions

 getFileName ($name)
 Helper function for getting a Mustache template file name.
 
 loadFile ($name)
 Helper function for loading a Mustache file by name.
 
 shouldCheckPath ()
 Only check if baseDir is a directory and requested templates are files if baseDir is using the filesystem stream wrapper.
 

Constructor & Destructor Documentation

◆ __construct()

Mustache_Loader_FilesystemLoader::__construct ( $baseDir,
array $options = array() )

Mustache filesystem Loader constructor.

Passing an $options array allows overriding certain Loader options during instantiation:

$options = array(
    // The filename extension used for Mustache templates. Defaults to '.mustache'
    'extension' => '.ms',
);
Exceptions
Mustache_Exception_RuntimeExceptionif $baseDir does not exist
Parameters
string$baseDirBase directory containing Mustache template files
array$optionsArray of Loader options (default: array())

Reimplemented in Mustache_Loader_ProductionFilesystemLoader.

Member Function Documentation

◆ getFileName()

Mustache_Loader_FilesystemLoader::getFileName ( $name)
protected

Helper function for getting a Mustache template file name.

Parameters
string$name
Return values
stringTemplate file name

Reimplemented in core\output\mustache_filesystem_loader.

◆ load()

Mustache_Loader_FilesystemLoader::load ( $name)

Load a Template by name.

$loader = new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/views');
$loader->load('admin/dashboard'); // loads "./views/admin/dashboard.mustache";
Parameters
string$name
Return values
stringMustache Template source

Implements Mustache_Loader.

Reimplemented in core\output\mustache_filesystem_loader.

◆ loadFile()

Mustache_Loader_FilesystemLoader::loadFile ( $name)
protected

Helper function for loading a Mustache file by name.

Exceptions
Mustache_Exception_UnknownTemplateExceptionIf a template file is not found
Parameters
string$name
Return values
stringMustache Template source

Reimplemented in Mustache_Loader_ProductionFilesystemLoader.

◆ shouldCheckPath()

Mustache_Loader_FilesystemLoader::shouldCheckPath ( )
protected

Only check if baseDir is a directory and requested templates are files if baseDir is using the filesystem stream wrapper.

Return values
boolWhether to check is_dir and file_exists

Reimplemented in core\output\mustache_filesystem_loader.


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