Interface for element type that support choices.
Description
Source
File: src/db-objects/elements/element-types/choice-element-type-interface.php
interface Choice_Element_Type_Interface { /** * Returns the available choices. * * @since 1.0.0 * * @param Element $element Element to get choices for. * @return array Associative array of `$field => $choices` pairs, with the main element field having the key '_main'. */ public function get_choices( $element ); /** * Returns the available choices for a specific field. * * @since 1.0.0 * * @param Element $element Element to get choices for. * @param string $field Optional. Element field for which to get choices. Default empty string (main field). * @return array Array of choices. */ public function get_choices_for_field( $element, $field = '' ); }
Changelog
Version | Description |
---|---|
1.0.0 | Introduced. |
Methods
- bootstrap — Bootstraps the element type by setting properties.
- filter_json — Filters the array representation of a given element of this type.
- get_edit_submission_fields_args — Gets the fields arguments for an element of this type when editing submission values in the admin.
- validate_field — Validates a field value for an element.