Issue Bug Closed

#92561f:variable with an array should insert keys when variable already exists

Wolfgang Klinger 10/14/20, 07:26 updated 04/27/22, 00:46

Description

Example

<f:variable name="settings" value="{'maxWidth': '200'}" />

should not remove/replace the existing settings variable,
but just add the key with the value into the existing ‘settings’ array variable.

That’s what I would expect, default case = common sense, how software should work.

If required I would add a new property ‘replace=true/false’ to allow the other (much less expected) behaviour.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

History 2

  1. Christoph Lehmann commented 11/08/20, 19:43

    Why not simple use another variable name? I don’t see a bug in the current behaviour.

  2. Simon Schaufelberger commented and changed status New Closed 04/27/22, 00:46

    If you want to set a different variable, use the “Alias” ViewHelper for a sub section or the variable viewhelper, that will overwrite the settings (which is always automatically assigned to every template) in this case like this:

    $this->variables[$identifier] = $value;