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_Form_Templates::get_template_blocks( string $location, boolean $reusable )
Retrieve a list of blocks for the given template
Parameters Parameters
- $location
-
(string) (Required) Form location id.
- $reusable
-
(boolean) (Required) Whether or not reusable blocks should be used.
Return Return
(array[])
Source Source
File: includes/forms/class-llms-form-templates.php
// Username only added when option is off on legacy sites.
if ( 'account' !== $location && ! llms_parse_bool( get_option( 'lifterlms_registration_generate_username', 'yes' ) ) ) {
array_unshift( $base, self::get_reusable_block( 'username' ) );
}
// Email and password go first on checkout/reg forms.
if ( 'account' !== $location ) {
$blocks = array_merge( $base, $blocks );
}
$blocks[] = self::get_block( 'name', $location, $reusable );
// Display name on account only, users can add to other forms if desired.
if ( 'account' === $location ) {
$blocks[] = self::get_block( 'display_name', $location, $reusable );
}
$blocks[] = self::get_block( 'address', $location, $reusable );
$blocks[] = self::get_block( 'phone', $location, $reusable );
if ( 'registration' === $location ) {
$blocks[] = self::get_voucher_block();
}
// Email and password go at the end on the account form.
if ( 'account' === $location ) {
$blocks = array_merge( $blocks, $base );
}
return array_filter( $blocks );
}
/**
* Retrieve block for the voucher row.
*
* @since 5.0.0
*
* @return array
*/
private static function get_voucher_block() {
// Don't include voucher if legacy option has vouchers hidden.
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 5.0.0 | Introduced. |