Element_Type::add_required_settings_field( string $section = 'settings' )

Adds a settings field for specifying whether the element is required to be filled in.

Description

See also

Parameters

$section

(string) (Optional) Settings section the settings field should be part of.

Default value: 'settings'

Source

File: src/db-objects/elements/element-types/element-type.php

	protected function add_required_settings_field( $section = 'settings' ) {
		$this->settings_fields['required'] = array(
			'section'     => $section,
			'type'        => 'radio',
			'label'       => __( 'Required?', 'torro-forms' ),
			'choices'     => array(
				'yes' => __( 'Yes', 'torro-forms' ),
				'no'  => __( 'No', 'torro-forms' ),
			),
			'description' => __( 'Whether the user must input something.', 'torro-forms' ),
			'default'     => 'no',
		);
	}

Changelog

Changelog
Version Description
1.0.0 Introduced.