LLMS_Form_Handler::get_fields( string $action, string $location, array $args = array() )
Retrieve fields for a given form.
Description Description
Ensures the form exists and that the current user can access the form.
Parameters Parameters
- $action
-
(string) (Required) User action to be performed. Either "update" (for an existing user) or "registration" for a new user.
- $location
-
(string) (Required) Form location ID.
- $args
-
(array) (Optional) Additional arguments passed to the short-circuit filter.
Default value: array()
Return Return
(WP_Error|array[]) Array of LLMS_Form_Field arrays on success or an error object on failure.
Source Source
File: includes/forms/class-llms-form-handler.php
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | protected function get_fields( $action , $location , $args = array () ) { $fields = LLMS_Forms::instance()->get_form_fields( $location , $args ); // Form couldn't be located. if ( false === $fields ) { // Translators: %s = form location ID. return new WP_Error( 'llms-form-invalid-location' , sprintf( __( 'The form location "%s" is invalid.' , 'lifterlms' ), $location ), $args ); } elseif ( 'account' === $location && 'update' !== $action ) { // No logged in user, can't update. return new WP_Error( 'llms-form-no-user' , __( 'You must be logged in to perform this action.' , 'lifterlms' ), $args ); } return $fields ; } |
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
5.0.0 | Introduced. |