Build the dropdown options and binds all nessecary events.

Uses createDivider and createOptionValue to create the necessary options.
168240
function() {

            this.$select.children().each($.proxy(function(index, element) {

                var $element = $(element);
                // Support optgroups and options without a group simultaneously.
                var tag = $element.prop('tagName')
                    .toLowerCase();

                if ($element.prop('value') === this.options.selectAllValue) {
                    return;
                }

                if (tag === 'optgroup') {
                    this.createOptgroup(element);
                }
                else if (tag === 'option') {

                    if ($element.data('role') === 'divider') {
                        this.createDivider();
                    }
                    else {
                        this.createOptionValue(element);
                    }

                }

                // Other illegal tags will be ignored.
            }, this));

            // Bind the change event on the dropdown elements.
            $('li input', this.$ul).on('change', $.proxy(function(event) {
                var $target = $(event.target);

                var checked = $target.prop('checked') || false;
                var isSelectAllOption = $target.val() === this.options.selectAllValue;

                // Apply or unapply the configured selected class.
                if (this.options.selectedClass) {
                    if (checked) {
                        $target.closest('li')
                            .addClass(this.options.selectedClass);
                    }
                    else {
                        $target.closest('li')
                            .removeClass(this.options.selectedClass);
                    }
                }

                // Get the corresponding option.
                var value = $target.val();
                var $option = this.getOptionByValue(value);

                var $optionsNotThis = $('option', this.$select).not($option);
                var $checkboxesNotThis = $('input', this.$container).not($target);

                if (isSelectAllOption) {
                    if (checked) {
                        this.selectAll();
                    }
                    else {
                        this.deselectAll();
                    }
                }

                if(!isSelectAllOption){
                    if (checked) {
                        $option.prop('selected', true);

                        if (this.options.multiple) {
                            // Simply select additional option.
                            $option.prop('selected', true);
                        }
                        else {
                            // Unselect all other options and corresponding checkboxes.
                            if (this.options.selectedClass) {
                                $($checkboxesNotThis).closest('li').removeClass(this.options.selectedClass);
                            }

                            $($checkboxesNotThis).prop('checked', false);
                            $optionsNotThis.prop('selected', false);

                            // It's a single selection, so close.
                            this.$button.click();
                        }

                        if (this.options.selectedClass === "active") {
                            $optionsNotThis.closest("a").css("outline", "");
                        }
                    }
                    else {
                        // Unselect option.
                        $option.prop('selected', false);
                    }
                }

                this.$select.change();

                this.updateButtonText();
                this.updateSelectAll();

                this.options.onChange($option, checked);

                if(this.options.preventInputChangeEvent) {
                    return false;
                }
            }, this));

            $('li a', this.$ul).on('mousedown', function(e) {
                if (e.shiftKey) {
                    // Prevent selecting text by Shift+click
                    return false;
                }
            });

            $('li a', this.$ul).on('touchstart click', $.proxy(function(event) {
                event.stopPropagation();

                var $target = $(event.target);

                if (event.shiftKey && this.options.multiple) {
                    if($target.is("label")){ // Handles checkbox selection manually (see https://github.com/davidstutz/bootstrap-multiselect/issues/431)
                        event.preventDefault();
                        $target = $target.find("input");
                        $target.prop("checked", !$target.prop("checked"));
                    }
                    var checked = $target.prop('checked') || false;

                    if (this.lastToggledInput !== null && this.lastToggledInput !== $target) { // Make sure we actually have a range
                        var from = $target.closest("li").index();
                        var to = this.lastToggledInput.closest("li").index();

                        if (from > to) { // Swap the indices
                            var tmp = to;
                            to = from;
                            from = tmp;
                        }

                        // Make sure we grab all elements since slice excludes the last index
                        ++to;

                        // Change the checkboxes and underlying options
                        var range = this.$ul.find("li").slice(from, to).find("input");

                        range.prop('checked', checked);

                        if (this.options.selectedClass) {
                            range.closest('li')
                                .toggleClass(this.options.selectedClass, checked);
                        }

                        for (var i = 0, j = range.length; i < j; i++) {
                            var $checkbox = $(range[i]);

                            var $option = this.getOptionByValue($checkbox.val());

                            $option.prop('selected', checked);
                        }
                    }

                    // Trigger the select "change" event
                    $target.trigger("change");
                }

                // Remembers last clicked option
                if($target.is("input") && !$target.closest("li").is(".multiselect-item")){
                    this.lastToggledInput = $target;
                }

                $target.blur();
            }, this));

            // Keyboard support.
            this.$container.off('keydown.multiselect').on('keydown.multiselect', $.proxy(function(event) {
                if ($('input[type="text"]', this.$container).is(':focus')) {
                    return;
                }

                if (event.keyCode === 9 && this.$container.hasClass('open')) {
                    this.$button.click();
                }
                else {
                    var $items = $(this.$container).find("li:not(.divider):not(.disabled) a").filter(":visible");

                    if (!$items.length) {
                        return;
                    }

                    var index = $items.index($items.filter(':focus'));

                    // Navigation up.
                    if (event.keyCode === 38 && index > 0) {
                        index--;
                    }
                    // Navigate down.
                    else if (event.keyCode === 40 && index < $items.length - 1) {
                        index++;
                    }
                    else if (!~index) {
                        index = 0;
                    }

                    var $current = $items.eq(index);
                    $current.focus();

                    if (event.keyCode === 32 || event.keyCode === 13) {
                        var $checkbox = $current.find('input');

                        $checkbox.prop("checked", !$checkbox.prop("checked"));
                        $checkbox.change();
                    }

                    event.stopPropagation();
                    event.preventDefault();
                }
            }, this));

            if(this.options.enableClickableOptGroups && this.options.multiple) {
                $('li.multiselect-group', this.$ul).on('click', $.proxy(function(event) {
                    event.stopPropagation();

                    var group = $(event.target).parent();

                    // Search all option in optgroup
                    var $options = group.nextUntil('li.multiselect-group');
                    var $visibleOptions = $options.filter(":visible:not(.disabled)");

                    // check or uncheck items
                    var allChecked = true;
                    var optionInputs = $visibleOptions.find('input');
                    optionInputs.each(function() {
                        allChecked = allChecked && $(this).prop('checked');
                    });

                    optionInputs.prop('checked', !allChecked).trigger('change');
                }, this));
            }
        }
352998
function () {
        var that = this;

        that.uniqueId = utils.uniqueId('i');

        that.createWrapper();
        that.notify('initialize');

        that.bindWindowEvents();

        that.setOptions();
        that.fixPosition();
    }
1166250
function (option) {
      var $parent = option.appendTo;
      if (!($parent instanceof $)) { $parent = $($parent); }
      var $el = $('<ul></ul>')
        .addClass(option.dropdownClassName)
        .attr('id', 'textcomplete-dropdown-' + option._oid)
        .css({
          display: 'none',
          left: 0,
          position: 'absolute',
          zIndex: option.zIndex
        })
        .appendTo($parent);
      return $el;
    }
1315228
function (value, options) {

        // Check the parameters and reassign if needed
        if (typeof value === 'object') {
            options = value;
            value = true;
        }

        var selectHandler = this.remember('_selectHandler') || new SelectHandler(this);

        selectHandler.init(value === undefined ? true : value, options || {});

        return this;

    }
263152
function() {
			var self = this;
	
			if (self.isLocked || self.isOpen || (self.settings.mode === 'multi' && self.isFull())) return;
			self.focus();
			self.isOpen = true;
			self.refreshState();
			self.$dropdown.css({visibility: 'hidden', display: 'block'});
			self.positionDropdown();
			self.$dropdown.css({visibility: 'visible'});
			self.trigger('dropdown_open', self.$dropdown);
		}
352036
function () {
            this.$DropDownListTrait._afterDropdownOpen.apply(this, arguments);
            if (this._cfg.waiAria) {
                var field = this.getTextInputField();
                var listWidget = this.controller.getListWidget();
                field.setAttribute("aria-owns", listWidget.getListDomId());
                var dropDownIcon = this._getDropdownIcon();
                if (dropDownIcon) {
                    dropDownIcon.setAttribute("aria-expanded", "true");
                }
                listWidget.afterWidgetLoaded({
                    fn: this._updateAriaActiveDescendant,
                    scope: this
                });
            }
        }
1158204
function() {

                    if(nativeMousedown && !customShowHideEvent) {

                        self._update($(this));

                        self.triggerEvent("option-mouseup");

                        // If the current drop down option is not disabled
                        if ($(this).attr("data-disabled") === "false" && $(this).attr("data-preventclose") !== "true") {

                            // Closes the drop down list
                            self.close();

                        }

                    }

                }
326140
function() {
    var elDropdown = this.getContainerEl().appendChild(document.createElement("select"));
    elDropdown.style.zoom = 1;
    if(this.multiple) {
        elDropdown.multiple = "multiple";
    }
    if(lang.isNumber(this.size)) {
        elDropdown.size = this.size;
    }
    this.dropdown = elDropdown;
    
    if(lang.isArray(this.dropdownOptions)) {
        var dropdownOption, elOption;
        for(var i=0, j=this.dropdownOptions.length; i<j; i++) {
            dropdownOption = this.dropdownOptions[i];
            elOption = document.createElement("option");
            elOption.value = (lang.isValue(dropdownOption.value)) ?
                    dropdownOption.value : dropdownOption;
            elOption.innerHTML = (lang.isValue(dropdownOption.label)) ?
                    dropdownOption.label : dropdownOption;
            elOption = elDropdown.appendChild(elOption);
        }
        
        if(this.disableBtns) {
            this.handleDisabledBtns();
        }
    }
}
150447
function defineOptionConstructor(constructor, code, name, repeatable, ...args) {
    optionConstructors[code] = optionConstructors[name] =
        constructor.create.bind(constructor, ...[code, name, repeatable, ...args]);
}
1291324
function(){
			var plugin = $(this.element).data("ui-" + this.options.pluginName) || $(this.element).data(this.options.pluginName),
				opts = this.options,
				actualOpts = plugin.options,
				availOptList = opts.optionList,
				$opts = $(this.options.optionTarget).empty(),
				$ul = $("<ul>").appendTo($opts),
				$li = null;
			$.each(availOptList, function(i, o){
				if( typeof o.value === "boolean"){
					$li = $("<li>").append(
						$("<input>", {
							id: o.name,
							name: o.name,
							type: "checkbox",
							checked: !!actualOpts[o.name]  //o.value
						})
					).append(
						$("<label>", {"for": o.name, text: " " + o.hint})
					);
				}else if( typeof o.value === "number" || typeof o.value === "string"){
					$li = $("<li>").append(
							$("<label>", {"for": o.name, text: " " + o.name})
						).append(
							$("<input>", {
								id: o.name,
								name: o.name,
								type: "text",
								value: actualOpts[o.name] //o.value
							})
						);
				}else if( $.isArray(o.value) ){
					$li = $("<li>")
						.append(
							$("<label>", {"for": o.name, text: " " + o.name})
						).append(
							$("<select>", {
								id: o.name,
								name: o.name,
								size: 1
							})
						);
					var $sel = $li.find("select");
					$.each(o.value, function(){
						$sel.append($("<option>", {
							value: this.value,
							text: this.name,
							selected: (actualOpts[o.name] == this.value)  //this.selected
						}));
					});
				}
				$ul.append($li);
			});
		}
978731
function(fieldOptions) {

      // Instanciate the field
      var fieldInstance = inputEx(fieldOptions,this);
      
	   this.inputs.push(fieldInstance);
      
      // Create an index to access fields by their name
      if(fieldInstance.options.name) {
         this.inputsNames[fieldInstance.options.name] = fieldInstance;
      }
      
      // Create the this.hasInteractions to run interactions at startup
      if(!this.hasInteractions && fieldOptions.interactions) {
         this.hasInteractions = true;
      }
      
	   // Subscribe to the field "updated" event to send the group "updated" event
      fieldInstance.updatedEvt.subscribe(this.onChange, this, true);
   	  
      return fieldInstance;
   }
371926
function buildDropdown(trumbowyg) {
        var dropdown = [];

        $.each(trumbowyg.o.plugins.lineheight.sizeList, function(index, size) {
            trumbowyg.addBtnDef('lineheight_' + size, {
                text: trumbowyg.lang.lineheights[size] || size,
                hasIcon: false,
                fn: function(){
                    trumbowyg.saveRange();
                    var text = trumbowyg.getRangeText();
                    if (text.replace(/\s/g, '') !== '') {
                        try {
                            var parent = getSelectionParentElement();
                            $(parent).css('lineHeight', size);
                        } catch (e) {
                        }
                    }
                }
            });
            dropdown.push('lineheight_' + size);
        });

        return dropdown;
    }
1205210
@UiThread
  public T create(S options) {
    T t = options.build(currentId, this);
    annotations.put(t.getId(), t);
    currentId++;
    updateSource();
    return t;
  }
16676
function() {
    var allOptions = this.dropdown.options,
        i=0, j=allOptions.length;

    // Look for multi-select selections
    if(lang.isArray(this.value)) {
        var allValues = this.value,
            m=0, n=allValues.length,
            hash = {};
        // Reset all selections and stash options in a value hash
        for(; i<j; i++) {
            allOptions[i].selected = false;
            hash[allOptions[i].value] = allOptions[i];
        }
        for(; m<n; m++) {
            if(hash[allValues[m]]) {
                hash[allValues[m]].selected = true;
            }
        }
    }
    // Only need to look for a single selection
    else {
        for(; i<j; i++) {
            if(this.value === allOptions[i].value) {
                allOptions[i].selected = true;
            }
        }
    }
}
976454
function(options)
	{
		options = options || {};

		this._modelBindersMap = null;
		this._collectionBinder = null;
		this._bindingIndex = null;
		this._itemAlias = null;

		this._subviewsStruct = null;
		this._explicitSubviewsStruct = null;
		this._pendingRefresh = false;
		this._pendingRefreshRoot = false;
		this._subviewsArgs = null;
		this._isRunning = false;
		this._isSuspended = false;
		this._template = null;
		this._isolated = false;
		this.subviews = null;

		if(options.isolated)
		{
			this._isolated = true;
		}

		if(options.parentView)
		{
			this.scope = options.scope || null;
			this._setParentView(options.parentView);
		}
		else if(options.scope) this.scope = mixin({}, options.scope);
		else this.scope = {};

		options.scope = null;

		if(options.events)
		{
			this.domEvents = options.events.slice();
		}
		else this.domEvents = [];

		if(options.dispatcher)
		{
			this.dispatcher = options.dispatcher;
		}
		else this.dispatcher = null;

		if(options.actions)
		{
			this.actions = mixin({
				set: actionSet
			}, options.actions);
		}
		else if((this.parentView == null || this._isolated )&& !options._clone)
		{
			this.actions = {
				set: actionSet
			};
		}
		else this.actions = null;

		if(options.env)
		{
			this.env = options.env;
		}
		else this.env = { document: document, window: window };

		if(options.element)
		{
			this.element = options.element
			options.element = null;
		}
		else this.element = this.env.document.body;

		this.options = options;
	}
1374829
public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $event = $options['data'];
        $builder
            ->add('start', null, [
                'label' => 'event.form.start',
                'date_widget' => 'single_text',
                'time_widget' => 'single_text',
            ])
            ->add('end', null, [
                'label' => 'event.form.end',
                'date_widget' => 'single_text',
                'time_widget' => 'single_text',
            ])
            ->add('name', null, [
                'label' => 'event.form.name',
            ])
            ->add('location', null, [
                'label' => 'event.form.location',
            ])
            ->add('description', CKEditorType::class, [
                'label' => 'event.form.description',
                'required' => false,
                'config' => ['toolbar' => 'basic'],
            ])
            ->add('full_company', CheckboxType::class, [
                'label' => 'event.form.full_company',
                'required' => false,
            ])
            ->add('invitations', CollectionType::class, [
                'label' => 'event.form.invitations',
                'entry_type' => InvitationType::class,
                'entry_options' => ['label' => false],
                'allow_add' => true,
                'allow_delete' => true,
                'by_reference' => false,
            ])
            ->add('colour', ChoiceType::class, [
                'label' => 'event.form.colour',
                'required' => false,
                'choices' => [
                    'event.form.colour_choices.red' => 'important',
                    'event.form.colour_choices.green' => 'success',
                    'event.form.colour_choices.yellow' => 'warning',
                    'event.form.colour_choices.blue' => 'info',
                    'event.form.colour_choices.dark' => 'inverse',
                    'event.form.colour_choices.purple' => 'special',
                ],
            ])
            ->add('active', ChoiceType::class, [
                // Show "unpublished" instead of active.
                'choice_loader' => new CallbackChoiceLoader(function () use ($event) {
                    yield 'event.form.status_choices.active' => true;
                    if (!$event->isPublished()) {
                        yield 'event.form.status_choices.unpublished' => false;
                    } else {
                        yield 'event.form.status_choices.archived' => false;
                    }
                }),
                'label' => 'event.form.status',
            ])
        ;
    }
589027
function setOptions(object, options) {
      options = object.options = _.assign({}, cloneDeep(object.constructor.options), cloneDeep(options));

      _.forOwn(options, function(value, key) {
        if (value != null) {
          // Add event listeners.
          if (/^on[A-Z]/.test(key)) {
            _.each(key.split(' '), function(key) {
              object.on(key.slice(2).toLowerCase(), value);
            });
          } else if (!_.has(object, key)) {
            object[key] = cloneDeep(value);
          }
        }
      });
    }