Basecoat\View::multiadd PHP Method

multiadd() public method

Add multiple content under multiple namespaces Optionally provide a prefix to be prepended to each namespace name
public multiadd ( Array $name_vals, String $prefix = null )
$name_vals Array array of name/value pairs to add
$prefix String prefix to prepend to each namespace name
    public function multiadd($name_vals, $prefix = null)
    {
        foreach ($name_vals as $name => $val) {
            $this->add("{$prefix}{$name}", $val);
        }
    }

Usage Example

Beispiel #1
0
 /**
  * Merge content blocks for this instance with passed instance
  *
  * @param \Basecoat\View $view Instance to add content blocks to
  * @return Integer number of content blocks merged
  */
 public function addToView($view)
 {
     $view->multiadd($this->blocks);
     return count($this->blocks);
 }