Element_Type::get_export_columns( awsmug\Torro_Forms\DB_Objects\Elements\Element $element )

Gets the columns required for an export.

Description

See also

Parameters

$element

(awsmug\Torro_Forms\DB_Objects\Elements\Element) (Required) Element to export columns for.

Return

(array) Associative array of <code>$column_slug => $column_label</code> pairs.

Source

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

	public function get_export_columns( $element ) {
		if ( is_a( $this, Choice_Element_Type_Interface::class ) && ! $this->use_single_export_column_for_choices( $element ) ) {
			$columns = array();

			foreach ( $element->get_element_choices() as $element_choice ) {
				$choice_slug = sanitize_title( $element_choice->value );

				$columns[ 'element_' . $element->id . '__main_' . $choice_slug ] = $element->label . ' - ' . $element_choice->value;
			}

			return $columns;
		}

		return array(
			'element_' . $element->id . '__main' => $element->label,
		);
	}

Changelog

Changelog
Version Description
1.0.0 Introduced.