summaryrefslogtreecommitdiffstats
path: root/library/Director/Web/Form/Element/OptionalYesNo.php
blob: 7ef6d7f74ee883a4baa3c50604a3441511cb1860 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php

namespace Icinga\Module\Director\Web\Form\Element;

/**
 * Input control for booleans, gives y/n
 */
class OptionalYesNo extends Boolean
{
    public function getValue()
    {
        $value = $this->getUnfilteredValue();

        if ($value === 'y' || $value === true) {
            return 'y';
        } elseif ($value === 'n' || $value === false) {
            return 'n';
        }

        return null;
    }
}