start_controls_section(
'give_login_settings',
[
'label' => __('GiveWP Login Widget', 'give'),
'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'login_url',
[
'label' => __('Redirect URL', 'give'),
'type' => \Elementor\Controls_Manager::URL,
'show_external' => false,
]
);
$this->add_control(
'give_form_info',
[
'label' => '',
'type' => \Elementor\Controls_Manager::RAW_HTML,
'content_classes' => 'give-info',
'raw' => '
' . __('GIVEWP LOGIN WIDGET', 'give') . '
' . __('This is the GiveWP Login widget.', 'give') . '
' . __('This is a sample Login 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 Login.', 'give') . '
'
]
);
$this->end_controls_section();
}
/**
* Render the [give_login] 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['login_url']['url']);
$html = do_shortcode(
'[give_login login_redirect="' . $link . '"]'
);
ob_start(); ?>
';
// Conditionally show frontend or preview form
if (!\Elementor\Plugin::$instance->editor->is_edit_mode()) {
echo $html;
} else {
echo $preview;
}
echo '';
}
}