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
358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 | private static function get_template_blocks( $location , $reusable ) { $blocks = array (); // Email and password are added in different locations depending on the form. $base = array ( self::get_block( 'email' , $location , $reusable ), self::get_block( 'password' , $location , $reusable ), ); // 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 ); } |
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
5.0.0 | Introduced. |