namespace WPForms\Integrations\Divi;
class WPFormsSelector extends ET_Builder_Module {
public $slug = 'wpforms_selector';
public $vb_support = 'on';
$this->name = esc_html__( 'WPForms', 'wpforms-lite' );
public function get_fields(): array {
$forms = wpforms()->obj( 'form' )->get( '', [ 'order' => 'DESC' ] );
if ( ! empty( $forms ) ) {
$forms = wp_list_pluck( $forms, 'post_title', 'ID' );
static function ( $form ) {
return htmlspecialchars_decode( $form, ENT_QUOTES );
$forms[0] = esc_html__( 'Select form', 'wpforms-lite' );
'label' => esc_html__( 'Form', 'wpforms-lite' ),
'option_category' => 'basic_option',
'toggle_slug' => 'main_content',
'default' => $default_value,
'label' => esc_html__( 'Show Title', 'wpforms-lite' ),
'type' => 'yes_no_button',
'option_category' => 'basic_option',
'toggle_slug' => 'main_content',
'off' => esc_html__( 'Off', 'wpforms-lite' ),
'on' => esc_html__( 'On', 'wpforms-lite' ),
'label' => esc_html__( 'Show Description', 'wpforms-lite' ),
'option_category' => 'basic_option',
'type' => 'yes_no_button',
'toggle_slug' => 'main_content',
'off' => esc_html__( 'Off', 'wpforms-lite' ),
'on' => esc_html__( 'On', 'wpforms-lite' ),
* Disable advanced fields configuration.
public function get_advanced_fields_config() {
* Render module on the frontend.
* @param array $attrs List of unprocessed attributes.
* @param string $content Content being processed.
* @param string $render_slug Slug of module that is used for rendering output.
public function render( $attrs, $content = null, $render_slug = '' ) {
if ( empty( $this->props['form_id'] ) ) {
'[wpforms id="%1$s" title="%2$s" description="%3$s"]',
absint( $this->props['form_id'] ),
(bool) apply_filters( 'wpforms_divi_builder_form_title', ! empty( $this->props['show_title'] ) && 'on' === $this->props['show_title'], absint( $this->props['form_id'] ) ),
(bool) apply_filters( 'wpforms_divi_builder_form_desc', ! empty( $this->props['show_desc'] ) && 'on' === $this->props['show_desc'], absint( $this->props['form_id'] ) )