ACF_Admin_Tool_Export::html_field_selectionpublicACF 5.6.3

Renders the checkboxes to select items to export.

Метод класса: ACF_Admin_Tool_Export{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

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

Список изменений

С версии 5.6.3 Введена.

Код ACF_Admin_Tool_Export::html_field_selection() ACF 6.4.2

public function html_field_selection() {
	// Ensure `l10n_var_export` is always false at the point we're outputting the options.
	acf_update_setting( 'l10n_var_export', false );
	// Reset the field-groups store which may have been corrupted by export.
	$store = acf_get_store( 'field-groups' );
	if ( $store ) {
		$store->reset();
	}

	$choices      = array();
	$selected     = $this->get_selected_keys();
	$field_groups = array_filter(
		acf_get_internal_post_type_posts( 'acf-field-group' ),
		'acf_internal_post_object_contains_valid_key'
	);

	if ( $field_groups ) {
		foreach ( $field_groups as $field_group ) {
			$choices[ $field_group['key'] ] = esc_html( $field_group['title'] );
		}
	}

	acf_render_field_wrap(
		array(
			'label'   => __( 'Select Field Groups', 'acf' ),
			'type'    => 'checkbox',
			'name'    => 'keys',
			'prefix'  => false,
			'value'   => $selected,
			'toggle'  => true,
			'choices' => $choices,
		)
	);

	$choices    = array();
	$selected   = $this->get_selected_keys();
	$post_types = array_filter(
		acf_get_internal_post_type_posts( 'acf-post-type' ),
		'acf_internal_post_object_contains_valid_key'
	);

	if ( $post_types ) {
		foreach ( $post_types as $post_type ) {
			$choices[ $post_type['key'] ] = esc_html( $post_type['title'] );
		}

		acf_render_field_wrap(
			array(
				'label'   => __( 'Select Post Types', 'acf' ),
				'type'    => 'checkbox',
				'name'    => 'post_type_keys',
				'prefix'  => false,
				'value'   => $selected,
				'toggle'  => true,
				'choices' => $choices,
			)
		);
	}

	$choices    = array();
	$selected   = $this->get_selected_keys();
	$taxonomies = array_filter(
		acf_get_internal_post_type_posts( 'acf-taxonomy' ),
		'acf_internal_post_object_contains_valid_key'
	);

	if ( $taxonomies ) {
		foreach ( $taxonomies as $taxonomy ) {
			$choices[ $taxonomy['key'] ] = esc_html( $taxonomy['title'] );
		}

		acf_render_field_wrap(
			array(
				'label'   => __( 'Select Taxonomies', 'acf' ),
				'type'    => 'checkbox',
				'name'    => 'taxonomy_keys',
				'prefix'  => false,
				'value'   => $selected,
				'toggle'  => true,
				'choices' => $choices,
			)
		);
	}

	$choices       = array();
	$selected      = $this->get_selected_keys();
	$options_pages = array_filter(
		acf_get_internal_post_type_posts( 'acf-ui-options-page' ),
		'acf_internal_post_object_contains_valid_key'
	);

	if ( $options_pages ) {
		foreach ( $options_pages as $options_page ) {
			$choices[ $options_page['key'] ] = esc_html( $options_page['title'] );
		}

		acf_render_field_wrap(
			array(
				'label'   => __( 'Select Options Pages', 'acf' ),
				'type'    => 'checkbox',
				'name'    => 'ui_options_page_keys',
				'prefix'  => false,
				'value'   => $selected,
				'toggle'  => true,
				'choices' => $choices,
			)
		);
	}
}