Google
Edit File: forms5orig.php
<?php //// FORMS - MENU //// function seamless_donations_admin5_forms_menu() { $args = array( 'id' => 'seamless_donations_tab_forms_page', 'title' => 'Seamless Donations - Form Options', // page title 'menu_title' => 'Form Options', // title on left sidebar 'tab_title' => 'Form Options', // title displayed on the tab 'object_types' => array('options-page'), 'option_key' => 'seamless_donations_tab_forms', 'parent_slug' => 'seamless_donations_tab_main', 'tab_group' => 'seamless_donations_tab_set', 'save_button' => 'Save Tweaks', ); // 'tab_group' property is supported in > 2.4.0. if (version_compare(CMB2_VERSION, '2.4.0')) { $args['display_cb'] = 'seamless_donations_cmb_options_display_with_tabs'; } $template_options = new_cmb2_box($args); seamless_donations_admin5_forms_levels_section_data($template_options); seamless_donations_admin5_forms_defaults_section_data($template_options); seamless_donations_admin5_forms_fields_section_data($template_options); seamless_donations_admin5_forms_tweaks_section_data($template_options); } add_action('cmb2_admin_init', 'seamless_donations_admin5_forms_menu'); //// FORMS - SECTION - GIVING LEVELS //// function seamless_donations_admin5_forms_levels_section_data($section_options) { $section_desc = 'Select one or more suggested giving levels for your donors to choose from.'; // promo $feature_desc = 'Giving Level Manager customizes donation levels, assigns labels for each level.'; $feature_url = 'http://zatzlabs.com/project/seamless-donations-giving-level-manager/'; $section_desc .= seamless_donations_get_feature_promo($feature_desc, $feature_url); $section_options->add_field(array( 'name' => 'Giving Levels', 'id' => 'seamless_donations_admin_forms_section_levels', 'type' => 'title', 'after_field' => $section_desc, )); $giving_levels = dgx_donate_get_giving_levels(); $giving_level_labels = array(); for ($i = 0; $i < count($giving_levels); ++$i) { $value = $giving_levels[$i]; $giving_level_labels[$value] = $value; } $section_options->add_field(array( 'name' => 'Display Levels', 'id' => 'dgx_donate_giving_levels', 'type' => 'multicheck', 'select_all_button' => true, 'options' => $giving_level_labels, )); seamless_donations_cmb2_add_action_button($section_options, "Save Giving Levels", "forms_save_giving_levels"); } //// FORMS - SECTION - DEFAULTS //// function seamless_donations_admin5_forms_defaults_section_data($section_options) { $section_desc = 'Select the currency you would like to receive donations in and the default country for the donation form.'; $section_options->add_field(array( 'name' => 'Defaults', 'id' => 'seamless_donations_admin_forms_section_defaults', 'type' => 'title', 'after_field' => $section_desc, )); $section_options->add_field(array( 'name' => 'Currency', 'id' => 'dgx_donate_currency', 'type' => 'select', 'show_option_none' => 'Please choose a default currency', 'select_all_button' => true, 'options' => dgx_donate_get_currency_list(), )); $section_options->add_field(array( 'name' => 'Country', 'id' => 'dgx_donate_default_country', 'type' => 'select', 'show_option_none' => 'Please choose a default country', 'select_all_button' => true, 'options' => dgx_donate_get_countries(), )); seamless_donations_cmb2_add_action_button($section_options, "Save Defaults", "forms_save_defaults"); } //// FORMS - SECTION - FIELDS //// function seamless_donations_admin5_forms_fields_section_data($section_options) { $section_desc = 'Choose which form fields and sections you would like to hide, show or require.'; $section_options->add_field(array( 'name' => 'Form Fields and Sections', 'id' => 'seamless_donations_admin_forms_section_fields', 'type' => 'title', 'after_field' => $section_desc, )); $form_display_options = array( 'true' => 'Show', 'false' => 'Don\'t Show', ); $form_display_options_with_require = array( 'true' => 'Show', 'false' => 'Don\'t Show', 'required' => 'Require', ); $section_options->add_field(array( 'name' => 'Designated Funds Checkbox and Section', 'id' => 'dgx_donate_show_designated_funds_section', 'type' => 'select', 'default' => 'false', 'options' => $form_display_options, )); $section_options->add_field(array( 'name' => 'Repeating Donation Checkbox', 'id' => 'dgx_donate_show_repeating_option', 'type' => 'select', 'default' => 'false', 'options' => $form_display_options, )); $section_options->add_field(array( 'name' => 'Tribute Gift Checkbox and Section', 'id' => 'dgx_donate_show_tribute_section', 'type' => 'select', 'default' => 'true', 'options' => $form_display_options, )); $section_options->add_field(array( 'name' => 'Employer Match Section', 'id' => 'dgx_donate_show_employer_section', 'type' => 'select', 'default' => 'false', 'options' => $form_display_options, )); $section_options->add_field(array( 'name' => 'Donor Telephone Field', 'id' => 'dgx_donate_show_donor_telephone_field', 'type' => 'select', 'default' => 'true', 'options' => $form_display_options_with_require, )); $section_options->add_field(array( 'name' => 'Donor Employer Field', 'id' => 'dgx_donate_show_donor_employer_field', 'type' => 'select', 'default' => 'false', 'options' => $form_display_options_with_require, )); $section_options->add_field(array( 'name' => 'Donor Occupation Field', 'id' => 'dgx_donate_show_donor_occupation_field', 'type' => 'select', 'default' => 'false', 'options' => $form_display_options_with_require, )); $section_options->add_field(array( 'name' => 'Mailing List Checkbox', 'id' => 'dgx_donate_show_mailing_list_option', 'type' => 'select', 'default' => 'false', 'options' => $form_display_options, )); $section_options->add_field(array( 'name' => 'Anonymous Donation Checkbox', 'id' => 'dgx_donate_show_anonymous_option', 'type' => 'select', 'default' => 'false', 'options' => $form_display_options, )); $section_options->add_field(array( 'name' => 'Donor Address Section', 'id' => 'dgx_donate_show_donor_address_fields', 'type' => 'select', 'default' => 'false', 'options' => $form_display_options, )); seamless_donations_cmb2_add_action_button($section_options, "Save Fields", "forms_save_fieldss"); } //// FORMS - SECTION - GIVING TWEAKS //// function seamless_donations_admin5_forms_tweaks_section_data($section_options) { $section_desc = 'Options that can tweak your form. Starting with one, undoubtedly more to come.'; $section_options->add_field(array( 'name' => 'Form Tweaks', 'id' => 'seamless_donations_admin_forms_section_tweaks', 'type' => 'title', 'after_field' => $section_desc, )); $section_options->add_field(array( 'name' => 'Label Tag', 'id' => 'dgx_donate_labels_for_input', 'type' => 'checkbox', 'default' => false, 'desc' => __ ( 'Add label tag to input form (may improve form layout for some themes)', 'seamless-donations'), )); }