Cybo Advanced Field EngineCyboweb Technologies · Documentation · v1.0.2

cafe_get_dynamic_form()

Purpose

Returns the HTML of a dynamic form instead of printing it, for shortcodes, page builders and template functions that need a string.

Syntax

cafe_get_dynamic_form( string|array $form ): string

Parameters

Parameter Type Default Description
$form string|array - A registered form ID, or form arguments. See cafe_dynamic_form() for every argument.

Return value

The escaped form HTML. When the current user may not use the form: a short message. When the arguments are wrong: the problem for people who manage CAFE, an empty string for everyone else.

Example

add_shortcode( 'event_form', function () {
	return cafe_get_dynamic_form( 'new-event' );
} );

Notes

  • CAFE already has the [cafe_dynamic_form id="…"] shortcode for registered forms; see Getting started.
  • The field scripts and styles are added to the page when a form is rendered.