Skip to main content

Gravity_Forms\Gravity_Forms\Settings\Fields\Select

Source: includes/settings/fields/class-select.php:9

Details​

  • Kind: class
  • Namespace: Gravity_Forms\Gravity_Forms\Settings\Fields
  • Extends: Base

Properties​

PropertyTypeDescription
$typestringField type.
$choicesarrayField choices.
$no_choicesstringMessage to display when no choices exist.
$enhanced_uiboolEnable enhanced UI with Select2.
$after_selectstringField content after select.

Methods​

MethodDescription
scripts()Register scripts to enqueue when displaying field.
markup()Render field.
get_options()Prepares an array of choices as an HTML string of options.
do_validation()Validate posted field value.
support_multiple()Determine if a select field supports multiple choices.

Method Reference​

scripts()​

public function scripts()

Register scripts to enqueue when displaying field.

Returns​

  • array

Since: 2.5

Source: includes/settings/fields/class-select.php:65

markup()​

public function markup()

Render field.

Returns​

  • string

Since: 2.5

Source: includes/settings/fields/class-select.php:92

get_options()​

public static function get_options( $choices, $selected )

Prepares an array of choices as an HTML string of options.

Parameters​

NameTypeDefaultDescription
$choicesarrayArray of drop down choices.
$selectedstringCurrently selected value.

Returns​

  • string

Since: 2.5

Source: includes/settings/fields/class-select.php:165

do_validation()​

public function do_validation( $value )

Validate posted field value.

Parameters​

NameTypeDefaultDescription
$valuestring | arrayPosted field value.

Since: 2.5

Source: includes/settings/fields/class-select.php:226

support_multiple()​

public function support_multiple()

Determine if a select field supports multiple choices.

Returns​

  • bool — true if the field supports multiple choices, false if not.

Since: 2.5

Source: includes/settings/fields/class-select.php:317