Media::filter_json( array $data, awsmug\Torro_Forms\DB_Objects\Elements\Element $element, awsmug\Torro_Forms\DB_Objects\Submissions\Submission|null $submission = null )

Filters the array representation of a given element of this type.

Description

See also

Parameters

$data

(array) (Required) Element data to filter.

$element

(awsmug\Torro_Forms\DB_Objects\Elements\Element) (Required) The element object to get the data for.

$submission

(awsmug\Torro_Forms\DB_Objects\Submissions\Submission|null) (Optional) Submission to get the values from, if available.

Default value: null

Return

(array) Array including all information for the element type.

Source

File: src/db-objects/elements/element-types/base/media.php

	public function filter_json( $data, $element, $submission = null ) {
		$data = parent::filter_json( $data, $element, $submission );

		$data['value'] = absint( $data['value'] );

		$data['hidden_name'] = $data['input_attrs']['name'];
		$data['input_attrs']['name'] = $this->get_file_id( $element );

		return $data;
	}

Changelog

Changelog
Version Description
1.0.0 Introduced.