start_controls_section(
'give_register_settings',
[
'label' => __('GiveWP Register Widget', 'give'),
'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'link',
[
'label' => __('Link', 'give'),
'type' => \Elementor\Controls_Manager::URL,
'description' => __('The url you want to redirect users to after they submit the registration form.', 'give'),
'show_external' => false,
'default' => [
'url' => '',
'is_external' => false,
'nofollow' => false,
],
]
);
$this->add_control(
'give_register_info',
[
'label' => '',
'type' => \Elementor\Controls_Manager::RAW_HTML,
'content_classes' => 'give-info',
'raw' => '
' . __('GIVEWP REGISTER WIDGET', 'give') . '
' . __('This is the GiveWP Register widget. Allow your visitors to register on your website.', 'give') . '
' . __('This is a sample register form with all fields exposed. This is only to help position and style the form with Elementor. If you want to see the live form, go to this page while logged out or in an Icognito browser.', 'give') . '
' . __('Visit the GiveWP Docs for more info on the GiveWP Register feature.', 'give') . '
'
]
);
$this->end_controls_section();
}
/**
* Render the [give_register] output on the frontend.
*
* Written in PHP and used to generate the final HTML.
*
* @since 4.7.0 migrated from givewp-elementor-widgets
* @access protected
*/
protected function render()
{
$settings = $this->get_settings_for_display();
$link = esc_url($settings['link']['url']);
$html = do_shortcode('
[give_register redirect="' . $link . '"]'
);
ob_start(); ?>
';
if (!\Elementor\Plugin::$instance->editor->is_edit_mode()) {
echo $html;
} else {
echo $preview;
}
echo '';
}
}