llms_get_user_information_fields_for_editor()

Retrieve user information fields used by the block editor


Description Description

This is used for JS localization purposes and returns a reduced set of data as used by the editor for validation purposes.


Top ↑

Return Return

(array[])


Top ↑

Source Source

File: includes/functions/llms-functions-user-information-fields.php

function llms_get_user_information_fields_for_editor() {

	$fields = llms_get_user_information_fields();

	/**
	 * Filters the list of keys included for user information fields when localized into the block editor
	 *
	 * @since 5.0.0
	 *
	 * @param string[] $keys Array of key names.
	 */
	$keys = apply_filters(
		'llms_get_user_information_fields_for_editor_keys',
		array(
			'id',
			'name',
			'label',
			'data_store',
			'data_store_key',
		)
	);

	// Add a value so we can use array_interect_key() later.
	$keys = array_fill_keys( $keys, 1 );

	// Return a reduced list.
	return array_map(
		function( $field ) use ( $keys ) {
			return array_intersect_key( $field, $keys );
		},
		$fields
	);
}


Top ↑

Changelog Changelog

Changelog
Version Description
5.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.