LLMS_Forms::get_form_blocks( string $location, array $args = array() )

Retrieve an array of parsed blocks for the form at a given location.


Parameters Parameters

$location

(string) (Required) Form location, one of: "checkout", "registration", or "account".

$args

(array) (Optional) Additional arguments passed to the short-circuit filter.

Default value: array()


Top ↑

Return Return

(array|false)


Top ↑

Source Source

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

	public function get_form_blocks( $location, $args = array() ) {

		$post = $this->get_form_post( $location, $args );
		if ( ! $post ) {
			return false;
		}

		$content  = $post->post_content;
		$content .= $this->get_additional_fields_html( $location, $args );

		$blocks = $this->parse_blocks( $content );

		/**
		 * Filters the parsed block list for a given LifterLMS form
		 *
		 * This hook can be used to programmatically modify, insert, or remove
		 * blocks (fields) from a form.
		 *
		 * @since 5.0.0
		 *
		 * @param array[] $blocks   Array of parsed WP_Block arrays.
		 * @param string  $location The request form location ID.
		 * @param array   $args     Additional arguments passed to the short-circuit filter.
		 */
		return apply_filters( 'llms_get_form_blocks', $blocks, $location, $args );

	}


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.