kartik\tree\TreeViewInput::initDropdown PHP Method

initDropdown() protected method

Initialize tree dropdown menu settings and options
protected initDropdown ( )
    protected function initDropdown()
    {
        $config = $this->dropdownConfig;
        $input = ArrayHelper::getValue($config, 'input', []);
        $dropdown = ArrayHelper::getValue($config, 'dropdown', []);
        $options = ArrayHelper::getValue($config, 'options', []);
        $css = ['form-control', 'dropdown-toggle', 'kv-tree-input'];
        if ($this->_disabled) {
            $css[] = 'disabled';
        }
        Html::addCssClass($input, $css);
        Html::addCssClass($dropdown, ['dropdown-menu', 'kv-tree-dropdown']);
        Html::addCssClass($options, ['dropdown', 'kv-tree-dropdown-container']);
        $id = $this->options['id'] . '-tree-input';
        $this->_placeholder = ArrayHelper::remove($input, 'placeholder', Yii::t('kvtree', 'Select...'));
        $this->_placeholder = Html::tag('span', $this->_placeholder, ['class' => 'kv-placeholder']);
        $config['dropdown'] = array_replace_recursive(['id' => $id . '-menu', 'role' => 'menu', 'aria-labelledby' => $id], $dropdown);
        $config['input'] = array_replace_recursive(['id' => $id, 'tabindex' => -1, 'data-toggle' => 'dropdown', 'aria-haspopup' => 'true', 'aria-expanded' => 'false'], $input);
        if (empty($config['caret'])) {
            $config['caret'] = self::CARET;
        }
        $config['options'] = $options;
        $this->dropdownConfig = $config;
    }