Helper method retrieving location options.

@return array
Array of time options to be used in form element.
187746
public function getLocationOptions() {
    static $options = [];

    if (!$options) {
      $options = [
        'All' => $this->t('All'),
        'branches' => [],
        'camps' => [],
      ];
      $map = [
        'branch' => 'branches',
        'camp' => 'camps',
      ];
      $query = $this->entityQuery
        ->get('node')
        ->condition('status', 1)
        ->condition('type', ['branch', 'camp'], 'IN');
      $entity_ids = $query->execute();
      $nodes = $this->entityTypeManager->getStorage('node')
        ->loadMultiple($entity_ids);
      foreach ($nodes as $id => $node) {
        $options[$map[$node->bundle()]][$id] = $node->getTitle();
      }
      // Remove empty option categories.
      foreach ($options as $key => $option) {
        if (empty($option)) {
          unset($options[$key]);
        }
      }
    }

    return $options;
  }
1328774
private function getOptions()
    {
        $options = [];
        foreach($this->optionsMap as $property => $name) {
            $options[$name] = $this->options[$property];
        }
        return $options;
    }
1132313
protected function getOptions()
	{
		$options = array();

		foreach ($this->element->children() as $option)
		{
			// Only add <option /> elements.
			if ($option->getName() != 'option')
			{
				continue;
			}

			// Create a new option object based on the <option /> element.
			$tmp = HtmlSelect::option(
				(string) $option['value'],
				Text::alt(trim((string) $option), preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname)), 'value', 'text',
				((string) $option['disabled'] == 'true')
			);

			// Set some option attributes.
			$tmp->class = (string) $option['class'];

			// Set some JavaScript option attributes.
			$tmp->onclick = (string) $option['onclick'];

			// Add the option object to the result set.
			$options[] = $tmp;
		}

		reset($options);

		return $options;
	}
848222
protected function getOptions()
	{
		// Initialize variables.
		$options = array();

		foreach ($this->element->children() as $option)
		{
			// Only add <option /> elements.
			if ($option->getName() != 'option')
			{
				continue;
			}

			$label = (isset($option[0]) ? $option[0] : $option['label']);

			// Create a new option object based on the <option /> element.
			$tmp = Dropdown::option(
				(string) $option['value'], trim((string) $label), 'value', 'text',
				((string) $option['disabled'] == 'true')
			);
			foreach ($option->attributes() as $index => $value)
			{
				$dataCheck = strtolower(substr($index, 0, 4));
				if ($dataCheck == 'data')
				{
					$tmp->$index = (string) $value;
				}
			}

			// Set some option attributes.
			$tmp->class = (string) $option['class'];

			// Set some JavaScript option attributes.
			$tmp->onclick = (string) $option['onclick'];

			// Add the option object to the result set.
			$options[] = $tmp;
		}

		reset($options);

		return $options;
	}
8968
public function getOptions()
    {
        // Loop through and figure out which values were selected.
        $options = array();
        $selectedValue = $this->getValueArray();
        foreach ($this->getSource() as $itemValue => $title) {
            $itemSelected = in_array($itemValue, $selectedValue)
                || in_array($itemValue, $this->getDefaultItems());
            $itemDisabled = $this->isDisabled()
                || in_array($itemValue, $this->getDisabledItems());
            $options[] = new ArrayData(array(
                'Title' => $title,
                'Value' => $itemValue,
                'Selected' => $itemSelected,
                'Disabled' => $itemDisabled,
            ));
        }

        $options = new ArrayList($options);
        $this->extend('updateGetOptions', $options);
        return $options;
    }
36432
public static function getGroupedTimeZones(): array
	{
		$timeZones = [];

		foreach(static::listIdentifiers() as $timeZone)
		{
			[$group, $city] = explode('/', $timeZone, 2) + [null, null];

			$timeZones[$group][$timeZone] = str_replace('_', ' ', $city);
		}

		unset($timeZones['UTC']);

		return $timeZones;
	}
687048
public function getLocations() {
    $data = [];

    $location_ids = $this->queryFactory->get('node')
      ->condition('type', 'branch')
      ->execute();

    if (!$location_ids) {
      return [];
    }

    $storage = $this->entityTypeManager->getStorage('node');
    $locations = $storage->loadMultiple($location_ids);

    foreach ($locations as $location) {
      $data[$location->id()] = [
        'title' => $location->label(),
      ];
    }

    return $data;
  }
325646
protected function prepareOptions()
    {
        $zones = [];

        foreach (\DateTimeZone::listIdentifiers() as $zone) {
            $pos = explode('/', $zone);

            if (count($pos) == 2) {
                $state = $pos[0];
                $city = $pos[1];
            } else {
                $state = $pos[0];
                $city = $pos[0];
            }

            if (!isset($zones[$state])) {
                $zones[$state] = [];
            }

            $zones[$state][] = new Option($city, $zone);
        }

        return $zones;
    }
1284504
public static function listTimezones() {
        if (self::$timezones === null) {
            self::$timezones = array();
            $offsets = array();
            $now = new DateTime();

            foreach (DateTimeZone::listIdentifiers() as $timezone) {
                $now->setTimezone(new DateTimeZone($timezone));
                $offsets[] = $offset = $now->getOffset();
                self::$timezones[$timezone] = '(' . self::formatGmtOffset($offset) . ') ' . self::formatTimezoneName($timezone);
            }

            array_multisort($offsets, self::$timezones);
        }

        return self::$timezones;
    }
1206737
public function getTimeOptions() {
    $options = [
      'all' => 'All'
    ];
    // Add options each half hour from 00:00:00 to 23:30:00 with values
    // 12:00:00 AM to 11:30:00 PM.
    $time = 18000;
    for ($i = 0; $i < 48; $i++) {
      $options[date('H:i:s', $time)] = date('g:i:s A', $time);
      $time += 1800;
    }
    return $options;
  }
958883
private static function getTimezones(): array
    {
        $timezones = [];

        foreach (\DateTimeZone::listIdentifiers() as $timezone) {
            $parts = explode('/', $timezone);

            if (\count($parts) > 2) {
                $region = $parts[0];
                $name = $parts[1].' - '.$parts[2];
            } elseif (\count($parts) > 1) {
                $region = $parts[0];
                $name = $parts[1];
            } else {
                $region = 'Other';
                $name = $parts[0];
            }

            $timezones[$region][str_replace('_', ' ', $name)] = $timezone;
        }

        return $timezones;
    }
341687
protected function getOptions()
	{
		$options = array();

		// Initialize some field attributes.
		$filter = (string) $this->element['filter'];
		$exclude = (string) $this->element['exclude'];
		$hideNone = (string) $this->element['hide_none'];
		$hideDefault = (string) $this->element['hide_default'];

		// Get the path in which to search for file options.
		$path = (string) $this->element['directory'];

		if (!is_dir($path))
		{
			$path = JPATH_ROOT . '/' . $path;
		}

		// Prepend some default options based on field attributes.
		if (!$hideNone)
		{
			$options[] = HtmlSelect::option('-1', Text::alt('JOPTION_DO_NOT_USE', preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname)));
		}

		if (!$hideDefault)
		{
			$options[] = HtmlSelect::option('', Text::alt('JOPTION_USE_DEFAULT', preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname)));
		}

		// Get a list of folders in the search path with the given filter.
		$folders = Folder::folders($path, $filter);

		// Build the options list from the list of folders.
		if (is_array($folders))
		{
			foreach ($folders as $folder)
			{
				// Check to see if the file is in the exclude mask.
				if ($exclude)
				{
					if (preg_match(chr(1) . $exclude . chr(1), $folder))
					{
						continue;
					}
				}

				$options[] = HtmlSelect::option($folder, $folder);
			}
		}

		// Merge any additional options in the XML definition.
		$options = array_merge(parent::getOptions(), $options);

		return $options;
	}
314397
protected function getGroups()
	{
		$groups = array();

		$select = new HtmlSelect;

		// Try to inject the text object into the field
		try
		{
			$select->setText($this->getText());
		}
		catch (\RuntimeException $exception)
		{
			// A Text object was not set, ignore the error and try to continue processing
		}

		// Get the list of time zones from the server.
		$zones = \DateTimeZone::listIdentifiers();

		// Build the group lists.
		foreach ($zones as $zone)
		{
			// Time zones not in a group we will ignore.
			if (strpos($zone, '/') === false)
			{
				continue;
			}

			// Get the group/locale from the timezone.
			list ($group, $locale) = explode('/', $zone, 2);

			// Only use known groups.
			if (in_array($group, self::$zones))
			{
				// Initialize the group if necessary.
				if (!isset($groups[$group]))
				{
					$groups[$group] = array();
				}

				// Only add options where a locale exists.
				if (!empty($locale))
				{
					$groups[$group][$zone] = $select->option($zone, str_replace('_', ' ', $locale), 'value', 'text', false);
				}
			}
		}

		// Sort the group lists.
		ksort($groups);

		foreach ($groups as &$location)
		{
			sort($location);
		}

		// Merge any additional groups in the XML definition.
		$groups = array_merge(parent::getGroups(), $groups);

		return $groups;
	}
200235
private function FetchOptions()
    {
        $strOptions = $this->Value('Options');
        $lines = Str::SplitLines($strOptions);
        $result = array();
        foreach ($lines as $line)
        {
            $dpPos = strpos($line, ':');
            if ($dpPos !== false)
            {
                $value = trim(substr($line, 0, $dpPos));
                $text = trim(substr($line, $dpPos + 1));
            }
            else
            {
                $value = $line;
                $text = '';
            }
            $result[$value] = $text;
        }
        return $result;
    }
273900
public function getDateTimePickerOptions()
    {
        if (! isset($this->dateTimePickerOptions['language']))
            $this->dateTimePickerOptions['language'] = config('app.locale');

        $available = ['en', 'pl', 'sv', 'de'];
        $this->dateTimePickerOptions['language'] =
            in_array($this->dateTimePickerOptions['language'], $available)
                ? $this->dateTimePickerOptions['language'] : 'en';

        return $this->dateTimePickerOptions;
    }
1204228
protected function getCurlOptions(): array
    {
        $options = [];

        $options[CURLOPT_RETURNTRANSFER] = true;
        $options[CURLOPT_HEADER] = true;

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

        switch ($this->getMethod()) {
            case self::POST:
                if (!$this->hasOption(CURLOPT_CUSTOMREQUEST)) {
                    $options[CURLOPT_CUSTOMREQUEST] = $this->getMethod();
                }

                if (!$this->hasOption(CURLOPT_POSTFIELDS)) {
                    $options[CURLOPT_POSTFIELDS] = count($this->getParams()) > 0 ? http_build_query($this->getParams()) : '';
                }

                if ($this->hasHeader('Content-Type') && $this->getHeader('Content-Type') == 'application/json') {
                    $options[CURLOPT_POSTFIELDS] = Json::encode($this->getParams());
                }
                break;

            case self::PUT:
            case self::DELETE:
                if (!$this->hasOption(CURLOPT_CUSTOMREQUEST)) {
                    $options[CURLOPT_CUSTOMREQUEST] = $this->getMethod();
                }

                if (!$this->hasOption(CURLOPT_POSTFIELDS)) {
                    $options[CURLOPT_POSTFIELDS] = count($this->params) > 0 ? http_build_query($this->params) : '';
                }
                break;
        }

        if (count($this->headers) > 0) {
            $options[CURLOPT_HTTPHEADER] = $this->getPreparedHeaders();
        }

        return $options;
    }
1303243
protected function getOptions(): array
	{
		$options = [];

		foreach($this->options as $group)
		{
			foreach($group as $name => $option)
			{
				$options[] = ['--' . $name, $option['description']];
			}
		}

		sort($options);

		return $options;
	}