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

feat(simpleplugin) Add %askme% support in SelectAttribute

Note that this may cause weird behavior or errors in some cases. For
 instance when a select value is inluencing other fields.
For simple cases it seems to work well enough.

issue #5834
parent d051d823
......@@ -66,6 +66,12 @@ class SelectAttribute extends Attribute
array_unshift($outputs, _('None'));
}
}
if ($this->isTemplate() && !in_array('%askme%', $choices)) {
$choices[] = '%askme%';
if (is_array($outputs)) {
$outputs[] = '%askme%';
}
}
$this->choices = $choices;
if (!in_array($this->defaultValue, $this->choices, TRUE) && isset($this->choices[0])) {
$this->defaultValue = $this->choices[0];
......@@ -202,6 +208,15 @@ class SelectAttribute extends Attribute
{
$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
......
Markdown is supported
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