Returns options builder based on values in value bag

@return OptionValueBuilderInterface
968376
protected function getBuilder()
    {
        $isArray = false;

        // guess builder type based on arguments
        if ($this->actions) {
            /** @var Action $action */
            $action = reset($this->actions);
            $arguments = $action->getArguments();
            if ($arguments) {
                $argument = reset($arguments);
                if (is_array($argument)) {
                    $isArray = true;
                }
            }
        }

        if ($isArray) {
            return new ArrayOptionValueBuilder();
        }

        return new StringOptionValueBuilder();
    }
985434
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'], trim((string) $option), '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;
	}
854957
protected function getOptions()
	{
		$options = 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
		}

		/** @var \SimpleXMLElement $option */
		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 = $select->option(
				(string) $option['value'], trim((string) $option), '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;
	}
991251
protected function getOptions()
	{
		// Initialize variables.
		$options = array();

		if ($this->element['option_blank'])
		{
			$options[] = Dropdown::option('', App::get('language')->txt('- Select -'), 'value', 'text');
		}

		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'],
				App::get('language')->alt(trim((string) $label), preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname)), '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;
	}
33401
public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder();
        $rootNode = $treeBuilder->root('lexik_translation');

        $storages = array(
            StorageInterface::STORAGE_ORM,
            StorageInterface::STORAGE_MONGODB,
            StorageInterface::STORAGE_PROPEL,
        );
        $registrationTypes = array('all', 'files', 'database');
        $inputTypes = array('text', 'textarea');

        $rootNode
            ->addDefaultsIfNotSet()
            ->children()
                ->scalarNode('base_layout')
                    ->cannotBeEmpty()
                    ->defaultValue('@LexikTranslationBundle/layout.html.twig')
                ->end()

                ->arrayNode('fallback_locale')
                    ->isRequired()
                    ->requiresAtLeastOneElement()
                    ->prototype('scalar')->end()
                    ->beforeNormalization()
                        ->ifString()
                        ->then(function ($value) { return array($value); })
                    ->end()
                ->end()

                ->arrayNode('managed_locales')
                    ->isRequired()
                    ->requiresAtLeastOneElement()
                    ->prototype('scalar')->end()
                ->end()

                ->scalarNode('grid_input_type')
                    ->cannotBeEmpty()
                    ->defaultValue('text')
                    ->validate()
                        ->ifNotInArray($inputTypes)
                        ->thenInvalid('The input type "%s" is not supported. Please use one of the following types: '.implode(', ', $inputTypes))
                    ->end()
                ->end()

                ->booleanNode('grid_toggle_similar')
                    ->defaultValue(false)
                ->end()

                ->booleanNode('auto_cache_clean')
                    ->defaultValue(false)
                ->end()

                ->integerNode('auto_cache_clean_interval')
                    ->defaultValue(null)
                ->end()

                ->arrayNode('storage')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->scalarNode('type')
                            ->cannotBeEmpty()
                            ->defaultValue(StorageInterface::STORAGE_ORM)
                            ->validate()
                                ->ifNotInArray($storages)
                                ->thenInvalid('The storage "%s" is not supported. Please use one of the following storage: '.implode(', ', $storages))
                            ->end()
                        ->end()
                        ->scalarNode('object_manager')
                        ->end()
                    ->end()
                ->end()

                ->arrayNode('resources_registration')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->scalarNode('type')
                            ->cannotBeEmpty()
                            ->defaultValue('all')
                            ->validate()
                                ->ifNotInArray($registrationTypes)
                                ->thenInvalid('Invalid registration type "%s". Please use one of the following types: '.implode(', ', $registrationTypes))
                            ->end()
                        ->end()
                        ->booleanNode('managed_locales_only')
                            ->defaultTrue()
                        ->end()
                    ->end()
                ->end()

                ->arrayNode('exporter')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->booleanNode('json_hierarchical_format')
                            ->defaultFalse()
                        ->end()
                        ->booleanNode('use_yml_tree')
                            ->defaultFalse()
                        ->end()
                    ->end()
                ->end()

                ->arrayNode('dev_tools')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->booleanNode('enable')
                            ->defaultFalse()
                        ->end()
                        ->booleanNode('create_missing')
                            ->defaultFalse()
                        ->end()
                        ->scalarNode('file_format')
                            ->defaultValue('yml')
                        ->end()
                    ->end()
                ->end()

            ->end()
        ;

        return $treeBuilder;
    }
79979
public static function default(): Options
    {
        $options = new static;
        $options->skipConstructor();
        $options->setPropertyAccessor(new PropertyAccessor());
        $options->setDefaultMappingOperation(new DefaultMappingOperation());
        $options->setNameResolver(new NameResolver());
        $options->registerObjectCrate(\stdClass::class);

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

		// Convert to name => name array.
		foreach (Manager::getStores() as $store)
		{
			$options[] = Dropdown::option($store, App::get('language')->txt('JLIB_FORM_VALUE_CACHE_' . $store), 'value', 'text');
		}

		$options = array_merge(parent::getOptions(), $options);

		return $options;
	}
960354
public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder();
        $rootNode = $treeBuilder->root('bugsnag');

        $rootNode
            ->children()
                ->scalarNode('api_key')
                    ->defaultValue(getenv('BUGSNAG_API_KEY') ?: null)
                ->end()
                ->scalarNode('endpoint')
                    ->defaultValue(getenv('BUGSNAG_ENDPOINT') ?: null)
                ->end()
                ->booleanNode('callbacks')
                    ->defaultValue(true)
                ->end()
                ->booleanNode('user')
                    ->defaultValue(true)
                ->end()
                ->scalarNode('app_type')
                    ->defaultNull()
                ->end()
                ->scalarNode('app_version')
                    ->defaultNull()
                ->end()
                ->booleanNode('batch_sending')
                    ->defaultValue(true)
                ->end()
                ->scalarNode('hostname')
                    ->defaultNull()
                ->end()
                ->booleanNode('send_code')
                    ->defaultValue(true)
                ->end()
                ->scalarNode('release_stage')
                    ->defaultNull()
                ->end()
                ->scalarNode('strip_path')
                    ->defaultNull()
                ->end()
                ->scalarNode('project_root')
                    ->defaultNull()
                ->end()
                ->booleanNode('auto_notify')
                    ->defaultValue(true)
                ->end()
                ->scalarNode('resolver')
                    ->defaultValue(SymfonyResolver::class)
                ->end()
                ->scalarNode('factory')
                    ->defaultValue(ClientFactory::class)
                ->end()
                ->scalarNode('client')
                    ->defaultValue(Client::class)
                ->end()
                ->scalarNode('listener')
                    ->defaultValue(BugsnagListener::class)
                ->end()
                ->arrayNode('notify_release_stages')
                    ->prototype('scalar')->end()
                    ->treatNullLike([])
                    ->defaultValue([])
                ->end()
                ->arrayNode('filters')
                    ->prototype('scalar')->end()
                    ->treatNullLike([])
                    ->defaultValue([])
                ->end()
            ->end();

        return $treeBuilder;
    }
89515
protected function getOptionsJS()
    {
        foreach ($this->optsMapper as $opt => $mapped)
        {
            if (($currOpt = $this->getOptVal($this->options, $opt)) && ($currOpt !== null)) {
                $this->setOpt($this->options, $mapped, $currOpt);
                $this->unsetOpt($this->options, $opt);
            }
        }

        $opts = $this->options;

        // stupid pie plugin
        if ( $this->getOptVal( $opts, 'seriesStorage', 'pie', 'show' ) === null ) {
            $this->setNestedOptVal( $opts, 'seriesStorage', 'pie', 'show', false );
        }
        
        $this->unsetOpt( $opts, 'seriesStorage' );
        $this->unsetOpt( $opts, 'seriesDefault' );

        return $this->makeJSArray($opts);
    }
362968
public function getValueSelectOptions()
    {
        if (!$this->hasData('value_select_options')) {
            $this->setData(
                'value_select_options',
                $this->sourceYesno->toOptionArray()
            );
        }

        return $this->getData('value_select_options');
    }
929625
public function getOptions()
    {
        //make sure the supplied options have been merged with the defaults
        if (empty($this->options)) {
            //validate the options and build them
            $this->validateOptions();
            $this->build();
            $this->options = array_merge($this->getDefaults(), $this->suppliedOptions);
        }

        return $this->options;
    }
207964
public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder();
        $rootNode = $treeBuilder->root('sidus_eav_model');
        /** @var NodeBuilder $attributeDefinition */
        $attributeDefinition = $rootNode
            ->children()
                ->scalarNode('data_class')->isRequired()->end()
                ->scalarNode('value_class')->isRequired()->end()
                ->booleanNode('serializer_enabled')->defaultFalse()->end()
                ->scalarNode('collection_type')->defaultValue(CollectionType::class)->end()
                ->scalarNode('context_form_type')->defaultNull()->end()
                ->variableNode('default_context')->defaultValue([])->end()
                ->arrayNode('global_context_mask')
                    ->prototype('scalar')->defaultValue([])->end()
                ->end()
                ->arrayNode('attributes')
                    ->useAttributeAsKey('code')
                    ->prototype('array')
                        ->performNoDeepMerging()
                        ->cannotBeOverwritten()
                        ->children();

        $this->appendAttributeDefinition($attributeDefinition);

        /** @var NodeBuilder $familyDefinition */
        $familyDefinition = $attributeDefinition
                        ->end()
                    ->end()
                ->end()
                ->arrayNode('families')
                    ->useAttributeAsKey('code')
                    ->prototype('array')
                        ->performNoDeepMerging()
                        ->cannotBeOverwritten()
                        ->children();

        $this->appendFamilyDefinition($familyDefinition);

        $familyDefinition
                        ->end()
                    ->end()
                ->end()
            ->end();

        return $treeBuilder;
    }
1050793
protected function getOptions()
    {
        if (!is_array($this->arguments['options']) && !($this->arguments['options'] instanceof \Traversable)) {
            return [];
        }
        $options = [];
        foreach ($this->arguments['options'] as $key => $value) {
            if (is_object($value)) {
                if ($this->hasArgument('optionValueField')) {
                    $key = ObjectAccess::getPropertyPath($value, $this->arguments['optionValueField']);
                    if (is_object($key)) {
                        if (method_exists($key, '__toString')) {
                            $key = (string)$key;
                        } else {
                            throw new ViewHelper\Exception('Identifying value for object of class "' . get_class($value) . '" was an object.', 1247827428);
                        }
                    }
                } elseif ($this->persistenceManager->getIdentifierByObject($value) !== null) {
                    $key = $this->persistenceManager->getIdentifierByObject($value);
                } elseif (method_exists($value, '__toString')) {
                    $key = (string)$value;
                } else {
                    throw new ViewHelper\Exception('No identifying value for object of class "' . get_class($value) . '" found.', 1247826696);
                }

                if ($this->hasArgument('optionLabelField')) {
                    $value = ObjectAccess::getPropertyPath($value, $this->arguments['optionLabelField']);
                    if (is_object($value)) {
                        if (method_exists($value, '__toString')) {
                            $value = (string)$value;
                        } else {
                            throw new ViewHelper\Exception('Label value for object of class "' . get_class($value) . '" was an object without a __toString() method.', 1247827553);
                        }
                    }
                } elseif (method_exists($value, '__toString')) {
                    $value = (string)$value;
                } elseif ($this->persistenceManager->getIdentifierByObject($value) !== null) {
                    $value = $this->persistenceManager->getIdentifierByObject($value);
                }
            }

            if ($this->hasArgument('translate')) {
                $value = $this->getTranslatedLabel($key, $value);
            }

            $options[$key] = $value;
        }
        if ($this->arguments['sortByOptionLabel']) {
            asort($options);
        }
        return $options;
    }
430833
public function getConfigTreeBuilder()
    {
        $builder = new TreeBuilder();
        $routing = $builder->root('routing');
        {
            $routing->children()->scalarNode('path');
            $routing->children()->scalarNode('cache_dir')->defaultValue(null);
            $routing->children()->variableNode('namespaces')->beforeNormalization()->ifString()->then(
                function ($v) {
                    return [$v];
                }
            );
        }

        return $builder;
    }
889707
protected function buildOptions(): array
    {
        if (is_string($this->options)) {
            $this->loadRemoteOptions($this->options);
        }

        if ($this->options instanceof \Closure) {
            $this->options = $this->options->call($this->filter, $this->filter->getValue());
        }

        if ($this->options instanceof Arrayable) {
            $this->options = $this->options->toArray();
        }

        if (empty($this->script)) {
            $placeholder = trans('admin.choose');

            $this->script = <<<SCRIPT
$(".{$this->getElementClass()}").select2({
  placeholder: "$placeholder"
});

SCRIPT;
        }

        Admin::script($this->script);

        return is_array($this->options) ? $this->options : [];
    }
558860
public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder();
        $rootNode = $treeBuilder->root($this->root);
        $rootNode
            ->children()
            ->scalarNode('default_form_theme')->defaultNull()->end()
            ->scalarNode('default_datagrid_template')
            ->defaultValue('SidusDataGridBundle:DataGrid:bootstrap4.html.twig')
            ->end()
            ->variableNode('default_column_value_renderer')
            ->defaultValue(new Reference(ColumnValueRendererInterface::class))
            ->beforeNormalization()->always($this->serviceResolver)->end()
            ->end()
            ->variableNode('default_column_label_renderer')
            ->defaultValue(new Reference(ColumnLabelRendererInterface::class))
            ->beforeNormalization()->always($this->serviceResolver)->end()
            ->end()
            ->variableNode('actions')->defaultValue([])->end()
            ->append($this->getDataGridConfigTreeBuilder())
            ->end();

        return $treeBuilder;
    }
1369448
public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder();
        $rootNode = $treeBuilder->root('framework');
        $rootNode
            ->children()
                ->arrayNode('language')
                    ->prototype('scalar')->end()
                ->end()
                ->booleanNode('prefer_cdn')
                    ->defaultFalse()
                ->end()
                ->scalarNode('project_name')
                    ->defaultValue('Demo')
                ->end()
                ->scalarNode('company_name')
                    ->defaultValue('Acme')
                ->end()
            ->end()
        ;
        $this->appendChordsNodes($rootNode);

        return $treeBuilder;
    }