mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-29 00:34:03 +02:00
Place the noscript button next to the element it is supposed to apply
This commit is contained in:
parent
7aae291f69
commit
62aacce469
@ -463,7 +463,15 @@ class Form extends Zend_Form
|
||||
$el = parent::createElement($type, $name, $options);
|
||||
|
||||
if ($el && $el->getAttrib('autosubmit')) {
|
||||
$el->addDecorator(new NoScriptApply()); // Non-JS environments
|
||||
$noScript = new NoScriptApply(); // Non-JS environments
|
||||
$decorators = $el->getDecorators();
|
||||
$pos = array_search('Zend_Form_Decorator_ViewHelper', array_keys($decorators)) + 1;
|
||||
$el->setDecorators(
|
||||
array_slice($decorators, 0, $pos, true)
|
||||
+ array(get_class($noScript) => $noScript)
|
||||
+ array_slice($decorators, $pos, count($decorators) - $pos, true)
|
||||
);
|
||||
|
||||
$class = $el->getAttrib('class');
|
||||
if (is_array($class)) {
|
||||
$class[] = 'autosubmit';
|
||||
@ -473,6 +481,7 @@ class Form extends Zend_Form
|
||||
$class .= ' autosubmit';
|
||||
}
|
||||
$el->setAttrib('class', $class); // JS environments
|
||||
|
||||
unset($el->autosubmit);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user