Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

LLMS_Forms::convert_settings_format( array $map, string $orignal_format )

Converts field settings formats


Description Description

There are small differences between the LLMS_Form_Fields settings array and the WP_Block settings array.

This method accepts an associative array in one format or the other and converts it from the original format to the opposite format.


Top ↑

Parameters Parameters

$map

(array) (Required) Associative array of settings.

$orignal_format

(string) (Required) The original format of the submitted $map. Either "field" for an array of LLMS_Form_Field settings or block for an array of WP_Block attributes.


Top ↑

Return Return

([type]) [description]


Top ↑

Source Source

File: includes/forms/class-llms-forms.php

	private function convert_settings_format( $map, $orignal_format ) {

		// Block attributes to LLMS_Form_Field settings.
		$keys = array(
			'field'      => 'type',
			'className'  => 'classes',
			'html_attrs' => 'attributes',
		);

		// LLMS_Form_Field settings to block attributes.
		if ( 'field' === $orignal_format ) {
			$keys = array_flip( $keys );
		}

		// Loop through the original map and rename the necessary keys.
		foreach ( $keys as $orig_key => $new_key ) {
			if ( isset( $map[ $orig_key ] ) ) {
				$map[ $new_key ] = $map[ $orig_key ];
				unset( $map[ $orig_key ] );
			}
		}

		return $map;

	}


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.