Skip to content

Textarea field

Loïc Antignac edited this page May 24, 2022 · 4 revisions

image

By default, textarea field only requests the following informations:

[
	'slug'   => 'company_add_address',
	'type'   => 'textarea',
	'labels' => [
		'label' => 'company_add_address_label',
		'help'  => 'company_add_address_help',
	],
],

The labels key contains the keys for retrieving the labels from the labels array at the root of the entity declaration. Eg:

$declarations[] = [
	'entity'   => 'Webaxones\Core\Option\SettingGroup',
		'labels'   => [
			'company_add_address_label'    => __( 'Additional address', 'webaxones-content' ),
			'company_add_address_help'     => __( 'Additional address of the company', 'webaxones-content' ),
		],

But it is also possible to format the textarea field with an additional key called args which takes an array of the optional arguments that an HTML 5 textarea can support.

Example:

[
	'slug'   => 'company_add_address',
	'type'   => 'textarea',
	'labels' => [
		'label' => 'company_add_address_label',
		'help'  => 'company_add_address_help',
	],
	'args'   => [
		'rows'        => '10',
		'id'          => 'company-add-address-id',
	],
],
Clone this wiki locally