function composite($label) {
		$args = func_get_args();
		array_shift($args); # remove $label

		$composite = \ran\CompositeField::instance($this->confs);
		$composite->fieldlabel_is($label);

		if (count($args) >= 1) {
			if (is_array($args[0])) {
				$array_shorthand = array_shift($args);
				foreach ($array_shorthand as $key => $value) {
					if (is_int($key)) {
						// treat value as fieldname
						$composite->addfield($this->field(null, $value, 'text'));
					}
					else { # key is not an int
						// treat key as fieldname and value as fieldtype
						$composite->addfield($this->field(null, $key, $value));
					}
				}
			}

			// add remaining HTMLFormFields
			foreach ($args as $field) {
				$composite->addfield($field);
			}
		}

		$composite
			->form_is($this)
			->fieldlabel_is($label)
			->fieldtemplate_is($this->fieldtemplate('composite'))
			->hintrenderer_is($this->hintrenderer('composite'))
			->errorrenderer_is($this->errorrenderer('composite'));

		return $composite;
	}
function composite($label) {
		$args = func_get_args();
		array_shift($args); # remove $label

		$composite = \ran\CompositeField::instance($this->confs);
		$composite->fieldlabel_is($label);

		if (count($args) >= 1) {
			if (is_array($args[0])) {
				$array_shorthand = array_shift($args);
				foreach ($array_shorthand as $key => $value) {
					if (is_int($key)) {
						// treat value as fieldname
						$composite->addfield($this->field(null, $value, 'text'));
					}
					else { # key is not an int
						// treat key as fieldname and value as fieldtype
						$composite->addfield($this->field(null, $key, $value));
					}
				}
			}

			// add remaining HTMLFormFields
			foreach ($args as $field) {
				$composite->addfield($field);
			}
		}

		$composite
			->form_is($this)
			->fieldlabel_is($label)
			->fieldtemplate_is($this->fieldtemplate('composite'))
			->hintrenderer_is($this->hintrenderer('composite'))
			->errorrenderer_is($this->errorrenderer('composite'));

		return $composite;
	}
function composite ( $ label ) { $ args = func_get_args ( ) ; array_shift ( $ args ) ; # remove $label $ composite = \ ran \ CompositeField :: instance ( $ this -> confs ) ; $ composite -> fieldlabel_is ( $ label ) ; if ( count ( $ args ) >= 1 ) { if ( is_array ( $ args [ 0 ] ) ) { $ array_shorthand = array_shift ( $ args ) ; foreach ( $ array_shorthand as $ key => $ value ) { if ( is_int ( $ key ) ) { // treat value as fieldname $ composite -> addfield ( $ this -> field ( null , $ value , 'text' ) ) ; } else { # key is not an int // treat key as fieldname and value as fieldtype $ composite -> addfield ( $ this -> field ( null , $ key , $ value ) ) ; } } } // add remaining HTMLFormFields foreach ( $ args as $ field ) { $ composite -> addfield ( $ field ) ; } } $ composite -> form_is ( $ this ) -> fieldlabel_is ( $ label ) -> fieldtemplate_is ( $ this -> fieldtemplate ( 'composite' ) ) -> hintrenderer_is ( $ this -> hintrenderer ( 'composite' ) ) -> errorrenderer_is ( $ this -> errorrenderer ( 'composite' ) ) ; return $ composite ; }
Any additonal parameters are interpreted as Fields that are part of the
composite. If an array is passed as second parameter the fields will be
interpreted as text Field.

Therefore the following:

$form->composite('Name', ['given_name', 'family_name']);

Is equivalent to this:

$form->composite
(
'Name',
$form->text(null, 'given_name'),
$form->text(null, 'family_name')
);

You may also specify a type by making entries associative:

[ 'address' => 'text', 'postalcode' => 'number' ]

@return \ran\CompositeField
Any additonal parameters are interpreted as Fields that are part of the composite . If an array is passed as second parameter the fields will be interpreted as text Field .