Links

Form

This block type renders a form.

Parameters

  • form - the name of a form to render;
  • redirect - true to refresh or URL to redirect the form on success;
  • values - optional field values to pre-fill;
  • attributes - the form HTML attributes.

Example

The code below renders the user registration form with an extra my-custom-class CSS class, and "[email protected]" default value in the Email field, refreshing the page on success.
echo ( new HivePress\Blocks\Form(
[
'form' => 'user_register',
'redirect' => true,
'values' => [
'email' => '[email protected]',
],
'attributes' => [
'class' => [ 'my-custom-class' ],
],
]
) )->render();
Last modified 1yr ago