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

Merge branch '5834-we-cannot-use-askme-in-booleanattribute-and-selectattribute' into '1.3-dev'

Resolve "We cannot use "askme" in BooleanAttribute and SelectAttribute"

See merge request fusiondirectory/fd!276
Showing with 15 additions and 0 deletions
+15 -0
...@@ -66,6 +66,12 @@ class SelectAttribute extends Attribute ...@@ -66,6 +66,12 @@ class SelectAttribute extends Attribute
array_unshift($outputs, _('None')); array_unshift($outputs, _('None'));
} }
} }
if ($this->isTemplate() && !in_array('%askme%', $choices)) {
$choices[] = '%askme%';
if (is_array($outputs)) {
$outputs[] = '%askme%';
}
}
$this->choices = $choices; $this->choices = $choices;
if (!in_array($this->defaultValue, $this->choices, TRUE) && isset($this->choices[0])) { if (!in_array($this->defaultValue, $this->choices, TRUE) && isset($this->choices[0])) {
$this->defaultValue = $this->choices[0]; $this->defaultValue = $this->choices[0];
...@@ -202,6 +208,15 @@ class SelectAttribute extends Attribute ...@@ -202,6 +208,15 @@ class SelectAttribute extends Attribute
{ {
$this->size = $size; $this->size = $size;
} }
function setParent (&$plugin)
{
parent::setParent($plugin);
if ($this->isTemplate() && !in_array('%askme%', $this->choices)) {
$this->choices[] = '%askme%';
$this->outputs['%askme%'] = '%askme%';
}
}
} }
/*! \brief This class allows to handle a select attribute which allow to choose an object /*! \brief This class allows to handle a select attribute which allow to choose an object
......
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