PHP Class Devise\Templates\TemplatesManager

ファイルを表示 Open project: devisephp/cms

Public Properties

Property Type Description
$errors array Errors are kept in an array and can be used later if validation fails and we want to know why
$message string This is a message that we can store why the validation failed
$messages Validation messages

Protected Properties

Property Type Description
$ConfigFileManager

Public Methods

Method Description
__construct ( FileManager $ConfigFileManager, Framework $Framework ) Construct a new template manager
createVarRules ( ) : void Validation rules for registering a new template
destroyTemplate ( string $templatePath ) : boolean Destroys a template by retrieving current config contents and unsetting the key (templatePath) then saving the updated contents
registerRules ( ) : void Validation rules for registering a new template
storeMultipleTemplates ( $inputs ) : boolean Validate and store multiple template entries to templates config
storeNewVariable ( string $templatePath, array $input ) : boolean Validate and store a new variable for a given template path
storeTemplate ( array $input ) : boolean Validate and store a template entry to templates config
updateTemplate ( array $input ) : boolean Validates and updates a template with the given input

Private Methods

Method Description
addNewVariable ( array $configContents, string $templatePath, array $input ) : array adds a brand new variable to the location specified in the form
castBooleans ( &$varData ) : void Takes care of casting 'true/false' strings to data type boolean
copyExistingVariable ( array $configContents, string $templatePath, $path ) : array takes an existing var path and copies it to the template path
prepVarsAndParams ( array $varInput ) : array Constructs formatted vars array ready for saving to the templates config file
processAndMergeNewVars ( &$input ) : void Processes input['template'] data and unsets any newVars array elements which have empty string values. After processing newVars data, its merged together with template vars array
removeEmptyParams ( array $arr ) : array Checks for any array keys with empty values and removes/unsets key(s) from array
validateInputVars ( array $input ) : boolean Validate input[template][vars]

Method Details

__construct() public method

Construct a new template manager
public __construct ( FileManager $ConfigFileManager, Framework $Framework )
$ConfigFileManager Devise\Support\Config\FileManager
$Framework Devise\Support\Framework

createVarRules() public method

Validation rules for registering a new template
public createVarRules ( ) : void
return void

destroyTemplate() public method

Destroys a template by retrieving current config contents and unsetting the key (templatePath) then saving the updated contents
public destroyTemplate ( string $templatePath ) : boolean
$templatePath string
return boolean

registerRules() public method

Validation rules for registering a new template
public registerRules ( ) : void
return void

storeMultipleTemplates() public method

Validate and store multiple template entries to templates config
public storeMultipleTemplates ( $inputs ) : boolean
return boolean

storeNewVariable() public method

Validate and store a new variable for a given template path
public storeNewVariable ( string $templatePath, array $input ) : boolean
$templatePath string
$input array
return boolean

storeTemplate() public method

Validate and store a template entry to templates config
public storeTemplate ( array $input ) : boolean
$input array
return boolean

updateTemplate() public method

Validates and updates a template with the given input
public updateTemplate ( array $input ) : boolean
$input array
return boolean

Property Details

$ConfigFileManager protected_oe property

protected $ConfigFileManager

$errors public_oe property

Errors are kept in an array and can be used later if validation fails and we want to know why
public array $errors
return array

$message public_oe property

This is a message that we can store why the validation failed
public string $message
return string

$messages public_oe property

Validation messages
public $messages