templater()->get($templates); } $this->templater()->add($templates); return $this; } /** * Format a template string with $data * * @param string $name The template name. * @param array $data The data to insert. * @return string */ public function formatTemplate($name, $data) { return $this->templater()->format($name, $data); } /** * templater * * @return \Cake\View\StringTemplate */ public function templater() { if (empty($this->_templater)) { $class = $this->config('templateClass') ?: 'Cake\View\StringTemplate'; $this->_templater = new $class(); $templates = $this->config('templates'); if ($templates) { if (is_string($templates)) { $this->_templater->add($this->_defaultConfig['templates']); $this->_templater->load($templates); } else { $this->_templater->add($templates); } } } return $this->_templater; } }