Gets the fields arguments for an element of this type when editing submission values in the admin.
Description
See also
Parameters
- $element
-
(awsmug\Torro_Forms\DB_Objects\Elements\Element) (Required) Element to get fields arguments for.
Return
(array) An associative array of <code>$field_slug => $field_args</code> pairs.
Source
File: src/db-objects/elements/element-types/element-type.php
public function get_edit_submission_fields_args( $element ) { $settings = $this->get_settings( $element ); $slug = $this->get_edit_submission_field_slug( $element->id ); $args = array( 'type' => 'text', 'label' => $element->label, ); if ( ! empty( $settings['placeholder'] ) ) { $args['placeholder'] = $settings['placeholder']; } if ( ! empty( $settings['description'] ) ) { $args['description'] = $settings['description']; } if ( ! empty( $settings['required'] ) && 'no' !== $settings['required'] ) { $args['required'] = true; } if ( ! empty( $settings['css_classes'] ) ) { $args['input_classes'] = explode( ' ', $settings['css_classes'] ); } if ( is_a( $this, Choice_Element_Type_Interface::class ) ) { $choices = $this->get_choices( $element ); $args['choices'] = ! empty( $choices['_main'] ) ? array_combine( $choices['_main'], $choices['_main'] ) : array(); } return array( $slug => $args, ); }
Changelog
Version | Description |
---|---|
1.0.0 | Introduced. |