Cake\View\StringTemplate::add PHP Метод

add() публичный Метод

### Example: $templater->add([ 'link' => '{{title}}' 'button' => '' ]);
public add ( array $templates )
$templates array An associative list of named templates.
    public function add(array $templates)
    {
        $this->config($templates);
        $this->_compileTemplates(array_keys($templates));
        return $this;
    }

Usage Example

Пример #1
0
 /**
  * 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;
 }
All Usage Examples Of Cake\View\StringTemplate::add