Skip to content

Commit 336da8c

Browse files
authored
Feature: add content to the "Get Started" tab with instructions about how to use the integration (#8205)
1 parent d82ad13 commit 336da8c

15 files changed

+576
-246
lines changed

src/PaymentGateways/TheGivingBlock/Actions/RegisterTheGivingBlockSettings.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,15 @@ public function __invoke()
4040
&& give_get_current_setting_tab() === 'gateways'
4141
&& give_get_current_setting_section() === 'the-giving-block'
4242
) {
43+
wp_enqueue_style('dashicons');
4344
wp_enqueue_style('giveTgbAdminPages', GIVE_PLUGIN_URL . 'src/PaymentGateways/TheGivingBlock/assets/css/adminPages.css', [], GIVE_VERSION);
4445
wp_enqueue_script('giveTgbAdminPages', GIVE_PLUGIN_URL . 'src/PaymentGateways/TheGivingBlock/assets/js/adminPages.js', ['jquery', 'wp-i18n'], GIVE_VERSION, true);
45-
wp_set_script_translations('giveTgbAdminPages', 'give-tgb');
46+
wp_set_script_translations('giveTgbAdminPages', 'give');
4647

4748
wp_localize_script('giveTgbAdminPages', 'giveTgbSettings', [
4849
'ajaxurl' => admin_url('admin-ajax.php'),
4950
'nonce' => wp_create_nonce('giveTgbNonce'),
51+
'getStartedUrl' => admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways&section=the-giving-block&group=get-started'),
5052
]);
5153
}
5254
});

src/PaymentGateways/TheGivingBlock/Admin/CustomFields/GetStartedSettingField.php

Lines changed: 3 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace Give\PaymentGateways\TheGivingBlock\Admin\CustomFields;
44

5+
use Give\PaymentGateways\TheGivingBlock\Admin\Tabs\GetStarted\GetStartedTabContent;
6+
57
/**
68
* Custom setting field for GiveWP > Payment Gateways > The Giving Block > Get Started tab.
79
*
@@ -18,58 +20,6 @@ class GetStartedSettingField
1820
*/
1921
public function handle(array $field): void
2022
{
21-
$classes = !empty($field['wrapper_class']) ? esc_attr($field['wrapper_class']) : '';
22-
$organizationTabUrl = admin_url(
23-
'edit.php?post_type=give_forms&page=give-settings&tab=gateways&section=the-giving-block&group=organization'
24-
);
25-
?>
26-
<div class="give-tgb-setting-field give-tgb-get-started <?php echo $classes; ?>">
27-
<p class="give-tgb-get-started-welcome">
28-
<?php esc_html_e('Welcome to The Giving Block. With this integration, you can accept cryptocurrency and stock donations. The Giving Block provides its own donation form, rendered via a shortcode or block in the WordPress block editor.', 'give'); ?>
29-
</p>
30-
31-
<div class="give-tgb-quick-start-box" style="background: #f0f8ff; border: 1px solid #0073aa; padding: 15px; border-radius: 5px; margin: 20px 0;">
32-
<h3 class="give-tgb-quick-start-title" style="margin-top: 0;">
33-
<span class="dashicons dashicons-rocket"></span> <?php esc_html_e('Quick Start', 'give'); ?>
34-
</h3>
35-
<p class="give-tgb-quick-start-intro">
36-
<?php esc_html_e('To get started with crypto and stock donations:', 'give'); ?>
37-
</p>
38-
<ol class="give-tgb-quick-start-steps">
39-
<li>
40-
<?php esc_html_e('Use the Organization tab to connect your existing organization or create a new one with The Giving Block.', 'give'); ?>
41-
</li>
42-
<li>
43-
<?php esc_html_e('Add The Giving Block donation form to any page or post using the shortcode or block in the editor.', 'give'); ?>
44-
</li>
45-
<li>
46-
<?php esc_html_e('Use the Options tab to manage your data and configure additional settings.', 'give'); ?>
47-
</li>
48-
</ol>
49-
<p class="give-tgb-quick-start-actions">
50-
<a href="<?php echo esc_url($organizationTabUrl); ?>" class="button button-secondary give-tgb-connect-organization-btn" data-give-tgb-switch-group="organization">
51-
<?php esc_html_e('Connect Organization', 'give'); ?>
52-
</a>
53-
</p>
54-
</div>
55-
</div>
56-
<script>
57-
(function() {
58-
document.addEventListener('DOMContentLoaded', function() {
59-
document.querySelectorAll('[data-give-tgb-switch-group]').forEach(function(btn) {
60-
btn.addEventListener('click', function(e) {
61-
e.preventDefault();
62-
var group = btn.getAttribute('data-give-tgb-switch-group');
63-
var menu = document.querySelector('.give-settings-section-content .give-settings-section-group-menu');
64-
if (!menu) return;
65-
var tabLink = menu.querySelector('a[data-group="' + group.replace(/["\\]/g, '\\$&') + '"]');
66-
if (tabLink) tabLink.click();
67-
return false;
68-
});
69-
});
70-
});
71-
})();
72-
</script>
73-
<?php
23+
give(GetStartedTabContent::class)->display();
7424
}
7525
}
Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
<?php
2-
3-
namespace Give\PaymentGateways\TheGivingBlock\Admin\CustomFields;
4-
5-
use Give\PaymentGateways\TheGivingBlock\Admin\Tabs\Options\OptionsTabContent;
6-
7-
/**
8-
* Custom setting field for GiveWP > Payment Gateways >The Giving Block > Options tab.
9-
*
10-
* @unreleased
11-
*/
12-
class OptionsSettingField
13-
{
14-
/**
15-
* Render the Options tab content.
16-
*
17-
* @unreleased
18-
*
19-
* @param array $field Field config (id, type, wrapper_class, etc.).
20-
*/
21-
public function handle(array $field): void
22-
{
23-
OptionsTabContent::display();
24-
}
25-
}
1+
<?php
2+
3+
namespace Give\PaymentGateways\TheGivingBlock\Admin\CustomFields;
4+
5+
use Give\PaymentGateways\TheGivingBlock\Admin\Tabs\Options\OptionsTabContent;
6+
7+
/**
8+
* Custom setting field for GiveWP > Payment Gateways >The Giving Block > Options tab.
9+
*
10+
* @unreleased
11+
*/
12+
class OptionsSettingField
13+
{
14+
/**
15+
* Render the Options tab content.
16+
*
17+
* @unreleased
18+
*
19+
* @param array $field Field config (id, type, wrapper_class, etc.).
20+
*/
21+
public function handle(array $field): void
22+
{
23+
OptionsTabContent::display();
24+
}
25+
}

0 commit comments

Comments
 (0)