@param mixed $selected

@return array
4453
public function parseValue($selected)
    {
        if (is_string($selected) && strpos($selected, ':::') !== false) {
            return explode(':::', $selected);
        }

        return $selected;
    }
530893
public function getChildBoxes($select = array())
    {
        if (is_array($select)) {
            $select = new Kwf_Component_Select($select);
        } else {
            $select = clone $select;
        }
        $select->whereBox(true);
        return $this->getRecursiveChildComponents($select);
    }
1140351
private static function getSelectOptions($list, $selectedValue) {
        $result = '';

        if ($selectedValue !== null && !is_array($selectedValue)) {
            $selectedValue = array($selectedValue);
        }

        foreach ($list as $item) {
            $itemAttr = array();
            $text = '';

            if ($item instanceof SelectListItem) {
                $text = $item->text;
                $itemAttr['value'] = $item->value;

                if ($item->disabled === true) {
                    $itemAttr['disabled'] = 'disabled';
                }

                if ($selectedValue === null && $item->selected === true) {
                    $itemAttr['selected'] = 'selected';
                }
                elseif ($selectedValue !== null && in_array($item->value, $selectedValue) === true) {
                    $itemAttr['selected'] = 'selected';
                }
            }
            else {
                $text = $item;

                if ($selectedValue !== null && in_array($item, $selectedValue)) {
                    $itemAttr['selected'] = 'selected';
                }
            }

            $attr = self::buildAttributes($itemAttr);

            $result .= '<option' . (!empty($attr) ? ' ' : '') . $attr . '>';
            $result .= htmlspecialchars($text);
            $result .= '</option>';
        }

        return $result;
    }
247460
protected function getSelect()
    {
        $html = '<select>';

        if (is_array($this->window['all'])) {
            $html .= $this->getOptionLinks($this->window['all']);
        }

        $html .= '</select>';

        return $html;
    }
80078
private function normalize($selection)
    {
        if (isset($selection['query'])) {
            return ['query' => $selection['query']];
        }

        if (is_string($selection) || (is_array($selection) && isset($selection[0]))) {
            return ['id' => $selection];
        }

        $selectionOpts = implode(PHP_EOL, [
            '',
            '* Document ID (<docId>)',
            '* Array of document IDs',
            '* Array containing "query"',
        ]);

        throw new InvalidArgumentException('Invalid selection, must be one of: ' . $selectionOpts);
    }
1150454
public function prioritylist($selected = null)
    {
        $html = $this->_template->getHelper('html');

        if (!$selected) {
            $selected = ComTodosDomainEntityTodo::PRIORITY_NORMAL;
        }

        $options = array(
            array(ComTodosDomainEntityTodo::PRIORITY_HIGHEST,    AnTranslator::_('COM-TODOS-TODO-PRIORITY-HIGHEST')),
            array(ComTodosDomainEntityTodo::PRIORITY_HIGH,        AnTranslator::_('COM-TODOS-TODO-PRIORITY-HIGH')),
            array(ComTodosDomainEntityTodo::PRIORITY_NORMAL,    AnTranslator::_('COM-TODOS-TODO-PRIORITY-NORMAL')),
            array(ComTodosDomainEntityTodo::PRIORITY_LOW,        AnTranslator::_('COM-TODOS-TODO-PRIORITY-LOW')),
            array(ComTodosDomainEntityTodo::PRIORITY_LOWEST,    AnTranslator::_('COM-TODOS-TODO-PRIORITY-LOWEST')),
        );

        return $html->select('priority', array('options' => $options, 'selected' => $selected))->class('input-medium')->id('todo-priority');
    }
559195
public function get_selected_users() {
        // Do a lazy load.
        if (is_null($this->selected)) {
            $this->selected = $this->load_selected_users();
        }
        return $this->selected;
    }
1083653
public function getData($search = false) {
        if ($this->option && method_exists($this->form, $this->option)) {
            return $this->form->{$this->option}(...[$search]);
        }

        return [];
    }
1227674
public function select($name, $list = [], $selected = null, array $selectAttributes = [], array $optionsAttributes = [], array $optgroupsAttributes = [])
    {
        $selectAttributes = $this->appendClassToOptions('form-control', $selectAttributes);

        if ($this->hasErrors($name)) {
            $selectAttributes = $this->appendClassToOptions('is-invalid', $selectAttributes);
        }

        return parent::select($name, $list, $selected, $selectAttributes, $optionsAttributes, $optgroupsAttributes);
    }
714582
public function toArray($request)
    {
        return [
            'id' => $this->id,
            'name' => $this->name,
            'identifier' => $this->identifier,
            'data_type' => $this->data_type,
            'field_type' => $this->field_type,
            'sort_order' => $this->sort_order,
            'dropdown_options' => $this->when($this->field_type == 'SELECT', new PropertyDropdownOptionCollectionResource($this->propertyDropdownOptions)),
            'use_for_all_products' => $this->use_for_all_products,
            'created_at' => $this->created_at,
            'updated_at' => $this->updated_at,
        ];
    }
115126
public function getFields ($selector = null) 
    {
        if ($selector === null) {
            return array_merge($this->_fields, Helper::flatten(Helper::mapMethod($this->_records, 'getFields')));
        } else {
            return $this->select(Field::match($selector));
        }
    }
50741
protected function _getListOptionsForElem() {
		$cachePath = 'DefaultOptions_Form_' . $this->_currUIlang;
		$cached = Cache::read($cachePath, CAKE_THEME_CACHE_KEY_HELPERS);
		if (!empty($cached)) {
			return $cached;
		}

		$result = [];
		$result['select'] = [
			'extraOpt' => [
				'actions-box',
				'container',
				'count-selected-text',
				'deselect-all-text',
				'dropdown-align-right',
				'dropup-auto',
				'header',
				'hide-disabled',
				'icon-base',
				'live-search',
				'live-search-normalize',
				'live-search-placeholder',
				'live-search-style',
				'max-options',
				'max-options-text',
				'mobile',
				'multiple-separator',
				'none-selected-text',
				'select-all-text',
				'selected-text-format',
				'select-on-tab',
				'show-content',
				'show-icon',
				'show-subtext',
				'show-tick',
				'size',
				'style',
				'tick-icon',
				'width',
				'window-padding',
			]
		];
		$result['dateTime'] = [
			'defaultOpt' => [
				'label' => false,
				'data-toggle' => 'datetimepicker'
			],
			'extraOpt' => [
				'date-format',
				'date-locale',
				'icon-type',
				'widget-position-horizontal',
				'widget-position-vertical'
			]
		];
		$result['spin'] = [
			'defaultOpt' => [
				'data-toggle' => 'spin',
				'data-spin-verticalbuttons' => 'true',
				'label' => false,
			],
			'extraOpt' => [
				'min',
				'max',
				'step',
				'decimals',
				'maxboostedstep',
				'verticalbuttons',
				'prefix',
				'prefix_extraclass',
				'postfix',
				'postfix_extraclass',
			]
		];
		$result['flag'] = [
			'defaultOpt' => [
				'type' => 'select'
			],
			'extraOpt' => [
				'country-url',
			],
			'divOpt' => [
				'data-toggle' => 'flag-select',
				'data-button-type' => 'btn-default form-control',
			]
		];
		$result['autocomplete'] = [
			'defaultOpt' => [
				'data-toggle' => 'autocomplete',
				'label' => false,
			],
			'extraOpt' => [
				'type',
				'plugin',
				'url',
				'local',
				'min-length'
			]
		];
		$result['createUploadForm'] = [
			'type' => 'file',
			'default' => false,
			'url' => false
		];
		$result['upload'] = [
			'btnTitle' => $this->Html->tag('span', __d('view_extension', 'Select file...')),
			'inputOpt' => [
				'type' => 'file',
				'secure' => false,
				'label' => false,
				'div' => false,
				'data-toggle' => 'fileupload',
				'name' => 'files',
				'data-fileupload-btntext-upload' => __d('view_extension', 'Upload'),
				'data-fileupload-btntext-abort' => __d('view_extension', 'Abort'),
				'data-fileupload-msgtext-processing' => __d('view_extension', 'Processing...'),
				'data-fileupload-msgtext-error' => __d('view_extension', 'File upload failed'),
			]
		];
		$result['createFormTabs'] = [
			'tabListOpt' => [
				'class' => 'nav nav-pills nav-stacked col-xs-4 col-sm-4 col-md-4 col-lg-4'
			],
			'tabContentClass' => 'tab-content col-xs-8 col-lg-8 col-sm-8 col-md-8 col-lg-8',
			'submitBtn' => [
				'title' => __d('view_extension', 'Save'),
				'options' => [
					'class' => 'btn btn-success btn-md',
					'div' => 'form-group text-center'
				]
			]
		];
		Cache::write($cachePath, $result, CAKE_THEME_CACHE_KEY_HELPERS);

		return $result;
	}
749158
protected function _isSelected($key, $selected)
    {
        if ($selected === null) {
            return false;
        }
        $isArray = is_array($selected);
        if (!$isArray) {
            $selected = $selected === false ? '0' : $selected;

            return (string)$key === (string)$selected;
        }
        $strict = !is_numeric($key);

        return in_array((string)$key, $selected, $strict);
    }
512095
public static function getSelectFields()
    {
        if ($select = request()->input('fields')) {
            $httpRequestSelectFields = explode(',', $select);

            if (strpos($select, '*') !== false) {
                $httpRequestSelectFields = ['*'];
            }
        }

        return $httpRequestSelectFields ?? [];
    }
797974
public function getValues() : array
    {
        $values = [];

        foreach ($this->getOptions() as $option) {
            if ($option->isSelected()) {
                $values[] = $option->getValue();
            }
        }

        return $values;
    }
352420
protected final function _getItems($select = null)
    {
        if (!$select) $select = $this->_getSelect();
        if (!$select) return array();

        return $this->getData()->parent->getComponent()->getItems($select);
    }
474967
public function getVariables() 
	{
		if(isset($this->attributes['class'])) {
			$this->attributes['class'] = trim($this
			->attributes['class'].' form-control');
		} else {
			$this->attributes['class'] = 'form-control';
		}
		
		return array(
			'attributes' 	=> $this->attributes,
			'items'			=> $this->items,
			'selected'		=> $this->value);
	}