Feature #3997

Enable bulk assignment of template variables

Added by Robert Lemke almost 12 years ago. Updated over 10 years ago.

Should have
Target version:
Start date:
Due date:
% Done:


Estimated time:
Has patch:


Currenly TemplateView::assign() expects two arguments: the key and the value of the variable to assign. When lots of variables are assigned this is not convenient - a signature for bulk assignments would help.

Enhance assign() so that if the first argument is an array, the function assumes that it is an array of keys and values which will be assigned. In that case the second argument must not be set (and if so, results in an exception).

$this->view->assign('foo', 'bar');
$this->view->assign('baz', 'quux');

// same as:

$this->view->assign(array('foo' => 'bar', 'baz' => 'quux');


Updated by Bastian Waidelich almost 12 years ago

  • Assignee changed from Sebastian Kurfuerst to Bastian Waidelich

Updated by Bastian Waidelich almost 12 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

Applied in changeset r2899.

Also available in: Atom PDF