Create the options for the Select
770190
protected function createFromSelect($elementName='from', $label='')
    {
        $valid   = array();
        $invalid = array();

        $organization  = $this->mailer->getOrganization();
        // The organization
        $key  = 'organization';
        if ($name = $organization->getContactName()) {
            $extra = $organization->getName();
        } else {
            $name  = $organization->getName();
            $extra = null;
        }
        if ($email = $organization->getEmail()) {
            $title     = false;
            $valid[]   = $key;
        } else {
            $title     = $this->_('Organization does not have an e-mail address.');
            $invalid[] = $key;
        }
        $options[$key] = $this->createMultiOption(array(\MUtil_Model::REQUEST_ID => $organization->getId()),
            $name, $email, $extra, $title,
            array('controller' => 'organization', 'action' => 'edit'));
        $this->fromOptions[$key] = $email;//$name . ' <' . $email . '>';

        // The user
        $key = 'user';
        $name  = $this->currentUser->getFullName();
        $extra = null;
        if ($email = $this->currentUser->getEmailAddress()) {
            $title     = false;
            $valid[]   = $key;
        } else {
            $title     = $this->_('You do not have an e-mail address.');
            $invalid[] = $key;
        }
        $options[$key] = $this->createMultiOption(array(),
            $name, $email, $extra, $title,
            array('controller' => 'option', 'action' => 'edit'));
        $this->fromOptions[$key] = $email;//$name . ' <' . $email . '>';

        // As "the" application
        $key = 'application';
        $user = $this->loader->getCurrentUser();
        if ($user->hasPrivilege('pr.plan.mail-as-application') &&
            isset($this->project->email['site'])) {

            if ($email = $this->project->email['site']) {
                $options['application'] = $this->createMultiOption(array(), $this->project->name, $email);
                $valid[]     = 'application';
                $this->fromOptions[$key] = $email;//$this->project->name . ' <' . $email . '>';
            }
        }

        $firstSelectable = reset($valid);
        $element = $this->form->createElement('radio', $elementName, array(
            'disable'      => $invalid,
            'escape'       => (!$this->view),
            'label'        => $label,
            'multiOptions' => $options,
            'required'     => true,
            'value'        => $firstSelectable,
            ));

        $element->addValidator('InArray', false, array('haystack' => $valid));
        return $element;
    }
1300583
def ng_option(options, opt = {})
    opt[:root_selector] ||= ng_root_selector
    row = ng.row(opt)
    ng_options(options, opt)[row]
  end
740687
private function loadOptionValues(): void
	{
		$this->optionValues = array_merge(
			Option::getDefaults($this->moduleId),
			Option::getForModule($this->moduleId)
		);
	}
914963
function placeChoices () {
  const ul = createChoiceUl();
  ul.addEventListener('animationend', () => choicesAnimating = false);
  choicesAnimating = true;
  choiceDiv.appendChild(ul);
}
51912
protected function buildSelect()
    {
        $selects = [];
        foreach ($this->select as $select) {
            $shouldBeQuoted = true;

            // Check our list of nonQuoteStrings to see if we should quote or not.
            foreach ($this->nonQuoteStrings as $nonQuoteString) {
                if (strpos(strtolower($select), $nonQuoteString) !== false) {
                    $shouldBeQuoted = false;
                    break;
                }
            }

            if ($shouldBeQuoted) {
                $selects[] = $this->getQuotedTableName() . '.' . $this->quoteIdentifier($select);
            } else {
                $selects[] = $select;
            }
        }
        return 'SELECT ' . implode(', ', $selects);
    }
875444
static SelectOptions newOptions() {
        SelectOptions options = JavaScriptObject.createObject().cast();
        options.init(Styles.FONT_AWESOME_BASE, IconType.CHECK.getCssName());
        return options;
    }
842031
function (options) {
		
			var i, length;
		
			inputEx.SelectField.superclass.setOptions.call(this, options);
		
			this.options.choices = lang.isArray(options.choices) ? options.choices : [];
		
			// Retro-compatibility with old pattern (changed since 2010-06-30)
			if (lang.isArray(options.selectValues)) {
			
				for (i = 0, length = options.selectValues.length; i < length; i += 1) {
				
					this.options.choices.push({
						value: options.selectValues[i],
						label: "" + ((options.selectOptions && !lang.isUndefined(options.selectOptions[i])) ? options.selectOptions[i] : options.selectValues[i])
					});
				
				}
			}
		
		}
675147
def invoke_select(object, question, *args, &block)
      options = Utils.extract_options!(args)
      choices = if block
                  []
                elsif args.empty?
                  possible = options.dup
                  options = {}
                  possible
                elsif args.size == 1 && args[0].is_a?(Hash)
                  Utils.extract_options!(args)
                else
                  args.flatten
                end

      list = object.new(self, options)
      list.(question, choices, &block)
    end
177109
function createChoiceUl () {
  const lis = story.currentChoices
    .map(choice => {
      const li = document.createElement('li');
      li.innerHTML = choice.text;
      createChoiceListener(li, choice.index);
      return li;
    });
  const ul = document.createElement('ul');
  Array.from(lis).forEach(li => ul.appendChild(li));
  ul.className = "choices current";
  return ul;
}
123767
function pick(obj, select) {
  var result = {};
  if (typeof select === 'string') {
    select = [].slice.call(arguments, 1);
  }
  var len = select.length;
  for (var i = 0; i < len; i++) {
    var key = select[i];
    if (key in obj) {
      result[key] = obj[key];
    }
  }
  return result;
}
193452
function (opts1 /*, …options*/) {
		var result = create(null);
		forEach.call(arguments, function (options) {
			if (!isValue$2(options)) { return; }
			process(Object(options), result);
		});
		return result;
	}
1259906
public function defaultSelectizeOptions()
    {
        $metadata = $this->metadata();
        $options = [];

        if (isset($metadata['data']['selectize_options'])) {
            $options = $metadata['data']['selectize_options'];
            $options = $this->parseSelectizeOptions($options);
        }

        if ($this->deferred()) {
            $placeholder = $this->translator()->trans('Search...');
        } else {
            $placeholder = $this->translator()->trans('Select...');
        }

        $options['placeholder'] = $placeholder;
        $prop = $this->property();
        if ($prop instanceof SelectablePropertyInterface) {
            $choices = iterator_to_array($this->choices());

            if (isset($options['options'])) {
                $options['options'] = array_merge($options['options'], $choices);
            } else {
                $options['options'] = $choices;
            }

            $items = $this->propertyVal();

            if ($prop instanceof AbstractProperty) {
                $items = $prop->parseVal($items);

                if ($prop->l10n()) {
                    $items = (string)$this->translator()->translation($items);
                }

                if (is_string($items)) {
                    $items = explode($prop->multipleSeparator(), $items);
                }
            }

            if (!$prop->multiple()) {
                $items = (array)$items;
            }

            if (!$items) {
                $items = [];
            }

            // workaround for object setter casting the property as object.
            if ($items instanceof ModelInterface) {
                $items = $this->mapObjToChoice($items)['value'];
            }

            if (is_scalar($items)) {
                $items = [$items];
            }

            if (!isset($options['items'])) {
                $options['items'] = [];
            }
            $options['items'] = array_merge($options['items'], $items);
        }

        return $options;
    }
798059
function (options) {
		
		var selectFieldConfig, operators, labels, selectOptions, newOptions, i, length;
		
		selectFieldConfig = this.generateSelectConfig(options.availableFields);
		
		operators = options.operators || ["=", ">", "<", ">=", "<=", "!=", "LIKE", "NOT LIKE", "IS NULL", "IS NOT NULL"];
		labels = options.operatorLabels || operators;
		
		selectOptions = [];
		
		for (i = 0, length = operators.length; i < length; i += 1) {
			selectOptions.push({ value: operators[i], label: labels[i] });
		}
		
		newOptions = {
			fields: [
				selectFieldConfig,
				{type: 'select', choices: selectOptions},
				this.nameIndex[options.availableFields[0].name]
			]
		};
		
		YAHOO.lang.augmentObject(newOptions, options);
		
		inputEx.KeyValueField.superclass.setOptions.call(this, newOptions);
	}
468145
public function makeselect($name, $values, $select = [], $size = 1, $multi = 0, $script = '')
    {
        if (!empty($select)) {
            if (is_array($select)) {
                foreach ($select as $item) {
                    $selected[$item] = 1;
                }
            } else {
                $selected[$select] = 1;
            }
        }

        if (!Utility::is_assoc($values)) {
            foreach ($values as $item) {
                $options[$item] = $item;
            }
        } else {
            $options = $values;
        }

        $html = sprintf("<select name='%s%s' size='%s'%s%s>\n", $name, ($multi) ? '[]' : '', $size, ($multi) ? ' multiple' : '', " $script");
        foreach ($options as $key => $value) {
            $html .= sprintf("<option value='%s'%s>%s</option>\n", $key, (isset($selected[$key])) ? ' selected' : '', $value);
        }
        $html .= "</select>\n";

        return $html;
    }
526889
def prepare_options(opts = [])
      opts.inject('') do |string, (option, value)|
        string += case
                  when value
                    create_option(option, value)
                  when option.respond_to?(:each_pair)
                    prepare_options(option)
                  else
                    create_option(option)
                  end
      end
    end
483822
protected function prepareOptions()
    {
        $options = $this->getOptions();
        $input = [];

        foreach ($options as $option) {
            $input[] = $this->option($option[0]);
        }

        $lastnsdelim = strrpos($input[1], '\\');

        $this->options[$options[0][0]] = $input[0] ?: rtrim($this->getAppNamespace(), '\\');
        $this->options[$options[1][0]] = substr($input[1], $lastnsdelim);
        $this->options[$options[2][0]] = $input[2] ?: ExtStr::tableize($input[1]);
        $this->options[$options[3][0]] = $input[3] ?: $this->options[$options[1][0]] . 'Closure';
        $this->options[$options[4][0]] = $input[4] ?: ExtStr::tableize($input[1] . 'Closure');
        $this->options[$options[5][0]] = $input[5] ? $input[5] : './app';
        $this->options[$options[6][0]] = $input[6] ? $input[6] : './database/migrations';
        $this->options[$options[7][0]] = $input[7] ?: false;
    }
180333
function() {
			
			var value, position, choice;
			
			if (this.el.selectedIndex !== 0) {
				
				// Get the selector value
				value = inputEx.MultiSelectField.superclass.getValue.call(this);
				
				position = this.getChoicePosition({ value : value });
				choice = this.choicesList[position];
				
				this.ddlist.addItem({ value: value, label: choice.label });
				
				// hide choice that has just been selected (+ select first choice)
				this.hideChoice({ position : position });
				this.el.selectedIndex = 0;
				
				this.fireUpdatedEvt();
				
			}
		}