public function storeNewVariable($templatePath, $input)
{
$validator = $this->Validator->make($input, $this->createVarRules(), $this->messages);
$copyVar = isset($input['copy_var']) && $input['copy_var'] !== '0' ? $input['copy_var'] : false;
if ($copyVar || $validator->passes()) {
$configContents = $this->ConfigFileManager->getAppOnly('devise.templates');
if ($copyVar) {
$configContents = $this->copyExistingVariable($configContents, $templatePath, $copyVar);
} else {
$configContents = $this->addNewVariable($configContents, $templatePath, $input);
}
return $this->ConfigFileManager->saveToFile($configContents, 'templates');
}
$this->errors = $validator->errors()->all();
return false;
}