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_Dynamic_Fields::toggle_for_password( array $password, array[] $blocks )

Adds a current password field and a toggle link button allowing the user to change their password


Parameters Parameters

$password

(array) (Required) Password field data as located by LLMS_Forms_Dynamic_Fields::find_block().

$blocks

(array[]) (Required) Array of WP_Block arrays.


Top ↑

Return Return

(array[])


Top ↑

Source Source

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

	private function toggle_for_password( $password, $blocks ) {

		// Add the toggle button.
		$blocks = $this->add_block(
			$blocks,
			array(
				'type'  => 'html',
				'id'    => 'llms-field-toggle--password',
				'value' => $this->get_toggle_button_html( '#password,#password_confirm,#llms-password-strength-meter,#password_current', $password[1]['attrs']['label'] ),
			),
			$password[1]['attrs']['meter'] ? $password[0] + 1 : $password[0]
		);

		/**
		 * Filters the settings used to create the dynamic password strength meter block
		 *
		 * @since 5.0.0
		 *
		 * @param array $settings Array or block attributes/settings.
		 */
		$current_password = apply_filters(
			'llms_current_password_field_settings',
			array(
				'type'            => 'password',
				'id'              => 'password_current',
				'name'            => 'password_current',
				'label'           => sprintf( __( 'Current %s', 'lifterlms' ), $password[1]['attrs']['label'] ),
				'required'        => true,
				'disabled'        => true,
				'data_store_key'  => false,
				'wrapper_classes' => 'llms-visually-hidden-field',
			)
		);
		return $this->add_block( $blocks, $current_password, $password[0] - 1 );

	}


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.