summaryrefslogtreecommitdiffstats
path: root/application/forms/ConfirmRemovalForm.php
blob: 39fc66154fff2139a0fb63550c33385bd53811e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
/* Icinga Web 2 | (c) 2013 Icinga Development Team | GPLv2+ */

namespace Icinga\Forms;

use Icinga\Web\Form;

/**
 * Form for confirming removal of an object
 */
class ConfirmRemovalForm extends Form
{
    const DEFAULT_CLASSES = 'icinga-controls';

    /**
     * {@inheritdoc}
     */
    public function init()
    {
        $this->setName('form_confirm_removal');
        $this->getSubmitLabel() ?: $this->setSubmitLabel($this->translate('Confirm Removal'));
    }

    /**
     * {@inheritdoc}
     */
    public function addSubmitButton()
    {
        parent::addSubmitButton();

        if (($submit = $this->getElement('btn_submit')) !== null) {
            $class = $submit->getAttrib('class');
            $submit->setAttrib('class', empty($class) ? 'autofocus' : $class . ' autofocus');
        }

        return $this;
    }
}