FOF30\Form\Field\Published::getOptions PHP Метод

getOptions() защищенный Метод

Method to get the field options.
С версии: 2.0
protected getOptions ( ) : array
Результат array The field option objects.
    protected function getOptions()
    {
        $options = parent::getOptions();
        if (!empty($options)) {
            return $options;
        }
        // If no custom options were defined let's figure out which ones of the
        // defaults we shall use...
        $config = array('published' => 1, 'unpublished' => 1, 'archived' => 0, 'trash' => 0, 'all' => 0);
        $configMap = array('show_published' => array('published', 1), 'show_unpublished' => array('unpublished', 1), 'show_archived' => array('archived', 0), 'show_trash' => array('trash', 0), 'show_all' => array('all', 0));
        foreach ($configMap as $attribute => $preferences) {
            list($configKey, $default) = $preferences;
            switch (strtolower($this->element[$attribute])) {
                case 'true':
                case '1':
                case 'yes':
                    $config[$configKey] = true;
                    break;
                case 'false':
                case '0':
                case 'no':
                    $config[$configKey] = false;
                    break;
                default:
                    $config[$configKey] = $default;
            }
        }
        $stack = array();
        if ($config['published']) {
            $stack[] = JHtml::_('select.option', '1', JText::_('JPUBLISHED'));
        }
        if ($config['unpublished']) {
            $stack[] = JHtml::_('select.option', '0', JText::_('JUNPUBLISHED'));
        }
        if ($config['archived']) {
            $stack[] = JHtml::_('select.option', '2', JText::_('JARCHIVED'));
        }
        if ($config['trash']) {
            $stack[] = JHtml::_('select.option', '-2', JText::_('JTRASHED'));
        }
        if ($config['all']) {
            $stack[] = JHtml::_('select.option', '*', JText::_('JALL'));
        }
        return $stack;
    }