Checkbox::format_values_for_export( array $values, awsmug\Torro_Forms\DB_Objects\Elements\Element $element, string $export_format )

Formats values for an export.

Description

See also

Parameters

$values

(array) (Required) Associative array of $field => $value pairs, with the main element field having the key '_main'.

$element

(awsmug\Torro_Forms\DB_Objects\Elements\Element) (Required) Element the values belong to.

$export_format

(string) (Required) Export format identifier. May be 'xls', 'csv', 'json', 'xml' or 'html'.

Return

(array) Associative array of <code>$column_slug => $column_value</code> pairs. The number of items and the column slugs must match those returned from the get_export_columns() method.

Source

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

	public function format_values_for_export( $values, $element, $export_format ) {
		$yes_no = $this->get_export_column_choices_yes_no( $element );

		$value = isset( $values['_main'] ) && $values['_main'] ? $yes_no[0] : $yes_no[1];

		return array(
			'element_' . $element->id . '__main' => $this->escape_single_value_for_export( $value, $export_format ),
		);
	}

Changelog

Changelog
Version Description
1.0.0 Introduced.