isProtected()) {
$value = $this->protected;
$disable = ' disabled="disabled"';
} else {
$value = is_null($this->local) ? $this->default : $this->local;
}
// ensure current value is included
if (!in_array($value, $this->choices)) {
$this->choices[] = $value;
}
// disable if no other choices
if (!$this->isProtected() && count($this->choices) <= 1) {
$disable = ' disabled="disabled"';
$nochoice = $plugin->getLang('nochoice');
}
$key = htmlspecialchars($this->key);
$label = '';
$input = "
\n";
$input .= ' $nochoice \n";
$input .= "
\n";
return [$label, $input];
}
/** @inheritdoc */
public function update($input)
{
if (is_null($input)) return false;
if ($this->isProtected()) return false;
$value = is_null($this->local) ? $this->default : $this->local;
if ($value == $input) return false;
if (!in_array($input, $this->choices)) return false;
$this->local = $input;
return true;
}
}