ACF_Admin_Tool_Export::get_selectedpublicACF 5.6.3

get_selected

This function will return the JSON data for given $_POST args

Method of the class: ACF_Admin_Tool_Export{}

No Hooks.

Returns

Array.

Usage

$ACF_Admin_Tool_Export = new ACF_Admin_Tool_Export();
$ACF_Admin_Tool_Export->get_selected();

Changelog

Since 5.6.3 Introduced.

ACF_Admin_Tool_Export::get_selected() code ACF 6.0.4

function get_selected() {

	// vars
	$selected = $this->get_selected_keys();
	$json     = array();

	// bail early if no keys
	if ( ! $selected ) {
		return false;
	}

	// construct JSON
	foreach ( $selected as $key ) {

		// load field group
		$field_group = acf_get_field_group( $key );

		// validate field group
		if ( empty( $field_group ) ) {
			continue;
		}

		// load fields
		$field_group['fields'] = acf_get_fields( $field_group );

		// prepare for export
		$field_group = acf_prepare_field_group_for_export( $field_group );

		// add to json array
		$json[] = $field_group;

	}

	// return
	return $json;

}