LLMS_Forms::load_reusable_blocks( array[] $blocks )
Loads reusable blocks into a block list.
Description Description
A reusable block contains a reference to the block post, e.g. <!-- wp:block {"ref":2198} /-->, which will be loaded during rendering.
Dereferencing the reusable blocks allows the entire block list to be reviewed and to validate all form fields. This function will replace each reusable block with the parsed blocks from its reference post.
Parameters Parameters
- $blocks
-
(array[]) (Required) An array of blocks from
parse_blocks(), where each block is usually an array cast fromWP_Block_Parser_Block.
Return Return
(array[])
Source Source
File: includes/forms/class-llms-forms.php
}
return $loaded;
}
/**
* Load form autosaves when previewing a form
*
* @since 5.0.0
*
* @param WP_Post|boolean $post WP_Post object for the llms_form post or `false` if no form found.
* @return WP_Post|boolean
*/
public function maybe_load_preview( $post ) {
// No form post found.
if ( ! is_object( $post ) ) {
return $post;
}
// The `_set_preview()` method is marked as private but has existed since 2.7 and my guess is that we can use this safely.
if ( ! function_exists( '_set_preview' ) ) {
return $post;
}
$is_preview = ( is_preview() && current_user_can( $this->get_capability(), $post->ID ) );
return $is_preview ? _set_preview( $post ) : $post;
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 5.1.0 | Access turned to public. |
| 5.0.0 | Introduced. |