protected static function generateInput($field, array $propertyConfig)
	{
		$type = \Arr::get($propertyConfig, 'type', 'text');

		// Build up a config array to pass to the parent
		$config = [
			'name'       => $field,
			'label'      => \Arr::get($propertyConfig, 'label', $field),
			'attributes' => \Arr::get($propertyConfig, 'attributes', []),
		];

		$content = \Arr::get($propertyConfig, 'options', false);

		if ($content !== false)
		{
			foreach ($content as $value => $contentName)
			{
				if (is_array($contentName))
				{
					$group = [
						'type'  => 'optgroup',
						'label' => $value,
					];

					foreach ($contentName as $optValue => $optName)
					{
						$group['content'][] = [
							'type'    => 'option',
							'value'   => $optValue,
							'content' => $optName,
						];
					}

					$config['content'][] = $group;
				}
				else
				{
					$config['content'][] = [
						'type'    => 'option',
						'value'   => $value,
						'content' => $contentName, // FIXME
						'label'   => $contentName,
					];
				}
			}
		}

		$irrelevantKeys = ['attributes', 'label', 'options', 'type'];

		$meta = \Arr::filter_keys($propertyConfig, $irrelevantKeys, true);

		$instance = static::$builder->generateInput($type, $config)
			->setMeta($meta);

		return $instance;
	}
protected static function generateInput($field, array $propertyConfig)
	{
		$type = \Arr::get($propertyConfig, 'type', 'text');

		// Build up a config array to pass to the parent
		$config = [
			'name'       => $field,
			'label'      => \Arr::get($propertyConfig, 'label', $field),
			'attributes' => \Arr::get($propertyConfig, 'attributes', []),
		];

		$content = \Arr::get($propertyConfig, 'options', false);

		if ($content !== false)
		{
			foreach ($content as $value => $contentName)
			{
				if (is_array($contentName))
				{
					$group = [
						'type'  => 'optgroup',
						'label' => $value,
					];

					foreach ($contentName as $optValue => $optName)
					{
						$group['content'][] = [
							'type'    => 'option',
							'value'   => $optValue,
							'content' => $optName,
						];
					}

					$config['content'][] = $group;
				}
				else
				{
					$config['content'][] = [
						'type'    => 'option',
						'value'   => $value,
						'content' => $contentName, // FIXME
						'label'   => $contentName,
					];
				}
			}
		}

		$irrelevantKeys = ['attributes', 'label', 'options', 'type'];

		$meta = \Arr::filter_keys($propertyConfig, $irrelevantKeys, true);

		$instance = static::$builder->generateInput($type, $config)
			->setMeta($meta);

		return $instance;
	}
protected static function generateInput ( $ field , array $ propertyConfig ) { $ type = \ Arr :: get ( $ propertyConfig , 'type' , 'text' ) ; // Build up a config array to pass to the parent $ config = [ 'name' => $ field , 'label' => \ Arr :: get ( $ propertyConfig , 'label' , $ field ) , 'attributes' => \ Arr :: get ( $ propertyConfig , 'attributes' , [ ] ) , ] ; $ content = \ Arr :: get ( $ propertyConfig , 'options' , false ) ; if ( $ content !== false ) { foreach ( $ content as $ value => $ contentName ) { if ( is_array ( $ contentName ) ) { $ group = [ 'type' => 'optgroup' , 'label' => $ value , ] ; foreach ( $ contentName as $ optValue => $ optName ) { $ group [ 'content' ] [ ] = [ 'type' => 'option' , 'value' => $ optValue , 'content' => $ optName , ] ; } $ config [ 'content' ] [ ] = $ group ; } else { $ config [ 'content' ] [ ] = [ 'type' => 'option' , 'value' => $ value , 'content' => $ contentName , // FIXME 'label' => $ contentName , ] ; } } } $ irrelevantKeys = [ 'attributes' , 'label' , 'options' , 'type' ] ; $ meta = \ Arr :: filter_keys ( $ propertyConfig , $ irrelevantKeys , true ) ; $ instance = static :: $ builder -> generateInput ( $ type , $ config ) -> setMeta ( $ meta ) ; return $ instance ; }
Processes the given field and returns an element

@param string $field          Name of the field to add
@param []     $propertyConfig Array of any config to be added to the field

@return Input Form input
Processes the given field and returns an element