Choice_Element_Type_Trait::add_choices_settings_field( string $field = '', string $section = 'content' )

Adds a settings field for specifying choices.

Description

Parameters

$field

(string) (Optional) Element field to which the choices should apply. Default empty string (main field).

Default value: ''

$section

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

Default value: 'content'

Source

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

	protected function add_choices_settings_field( $field = '', $section = 'content' ) {
		if ( empty( $field ) ) {
			$field = '_main';
		}

		$this->settings_fields[ 'choices_' . $field ] = array(
			'section'       => $section,
			'type'          => 'torrochoices',
			'label'         => __( 'Choices', 'torro-forms' ),
			'description'   => __( 'Specify the choices to select from.', 'torro-forms' ),
			'input_classes' => array( 'regular-text' ),
			'repeatable'    => true,
			'is_choices'    => $field,
		);
	}

Changelog

Changelog
Version Description
1.0.0 Introduced.