Media::get_edit_submission_fields_args( awsmug\Torro_Forms\DB_Objects\Elements\Element $element )

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/base/media.php

	public function get_edit_submission_fields_args( $element ) {
		$fields = parent::get_edit_submission_fields_args( $element );

		$slug = $this->get_edit_submission_field_slug( $element->id );

		$fields[ $slug ]['type'] = 'media';
		$fields[ $slug ]['store'] = 'id';

		$settings = $this->get_settings( $element );

		if ( ! empty( $settings['file_type'] ) && 'any' !== $settings['file_type'] ) {
			if ( 0 === strpos( $settings['file_type'], 'type_' ) ) {
				$field[ $slug ]['mime_types'] = substr( $settings['file_type'], 5 );
			} else {
				$field[ $slug ]['mime_types'] = $settings['file_type'];
			}
		}

		return $fields;
	}

Changelog

Changelog
Version Description
1.0.0 Introduced.