Commit 89ac4806 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

Merge branch '5745-special-caller-tags-should-be-available-in-templates-as-well' into '1.3-dev'

Resolve "Special caller* tags should be available in templates as well"

See merge request fusiondirectory/fd!99
Showing with 10 additions and 3 deletions
+10 -3
......@@ -35,6 +35,8 @@ class template
protected $applied = FALSE;
static protected $uiSpecialAttributes = array('dn','cn','uid','sn','givenName');
static function plInfo()
{
return array(
......@@ -268,7 +270,12 @@ class template
}
unset($array);
$this->attrs = templateHandling::parseArray($this->attrs);
$ui = get_userinfo();
$specialAttrs = array();
foreach (static::$uiSpecialAttributes as $attr) {
$specialAttrs['caller'.strtoupper($attr)] = $ui->$attr;
}
$this->attrs = templateHandling::parseArray($this->attrs, $specialAttrs);
$this->tabObject->adapt_from_template($this->attrs, call_user_func_array('array_merge', $this->attributes));
$this->applied = TRUE;
......
......@@ -187,7 +187,7 @@ class templateHandling
*
* \return array An array with the final values of attributes
*/
public static function parseArray(array $attrs)
public static function parseArray(array $attrs, array $specialAttrs)
{
foreach ($attrs as &$attr) {
if (is_array($attr)) {
......@@ -195,7 +195,7 @@ class templateHandling
if (!is_numeric($key)) {
continue;
}
$string = static::parseString($string, $attrs);
$string = static::parseString($string, array_merge($attrs, $specialAttrs));
}
unset($string);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment