Metabox-Settings.php
93 lines
| 1 | <?php |
| 2 | |
| 3 | global $post; |
| 4 | |
| 5 | use Give\Form\Template; |
| 6 | use Give\Helpers\Form\Template as FormTemplateUtils; |
| 7 | use Give\Helpers\Form\Template\Utils\Admin as AdminFormTemplateUtils; |
| 8 | |
| 9 | $activatedTemplate = FormTemplateUtils::getActiveID($post->ID); |
| 10 | $registeredTemplates = Give()->templates->getTemplates(); |
| 11 | ?> |
| 12 | <div class="form_template_options_wrap inner-panel<?php |
| 13 | echo $activatedTemplate ? ' has-activated-template' : ''; ?>"> |
| 14 | <strong class="templates-list-heading"><?php |
| 15 | _e('Available Form Templates', 'give'); ?></strong> |
| 16 | <div class="templates-list"> |
| 17 | <?php |
| 18 | /* @var Template $template */ |
| 19 | foreach ($registeredTemplates as $template) { |
| 20 | $isActive = $activatedTemplate === $template->getID(); |
| 21 | |
| 22 | printf( |
| 23 | '<div class="template-info %1$s" data-id="%2$s"> |
| 24 | <img class="template-image" src="%3$s"/> |
| 25 | <div class="action"> |
| 26 | <div class="template-name">%4$s <span class="badge">%5$s</span></div> |
| 27 | <button class="button %7$s">%6$s</button> |
| 28 | </div> |
| 29 | </div>', |
| 30 | $template->getID() . ($isActive ? ' active' : ''), |
| 31 | $template->getID(), |
| 32 | $template->getImage(), |
| 33 | $template->getName(), |
| 34 | __('active', 'give'), |
| 35 | $isActive ? __('Deactivate', 'give') : __('Activate', 'give'), |
| 36 | $isActive ? 'js-template--deactivate' : 'js-template--activate' |
| 37 | ); |
| 38 | } |
| 39 | ?> |
| 40 | </div> |
| 41 | |
| 42 | <div class="form-template-introduction"> |
| 43 | <p> |
| 44 | <?php |
| 45 | _e('What Are Form Templates?', 'give'); ?> |
| 46 | </p> |
| 47 | <p class="give-field-description form-template-description"><?php |
| 48 | _e( |
| 49 | 'Form Templates allow you to change the appearance of a GiveWP donation form on your site. Each template has a different design, layout, and features. Choose the one that suits your taste and the requirements for your cause. Note: compatibility with add-ons and third-party plugins or themes is not guaranteed. Always thoroughly test your donation forms before going live!', |
| 50 | 'give' |
| 51 | ); ?></p> |
| 52 | |
| 53 | <div class="form-template-notice"> |
| 54 | <img src="<?= esc_url(GIVE_PLUGIN_URL . 'build/assets/dist/images/admin/cap-books.svg'); ?>" alt="" /> |
| 55 | <p> |
| 56 | <?= esc_html__('Learn the ins and outs of creating the perfect Donation Form with GiveWP', 'give'); ?> |
| 57 | </p> |
| 58 | <a href="http://docs.givewp.com/form-templates/" target="_blank"> |
| 59 | <?= __('Learn More', 'give'); ?> |
| 60 | <svg viewbox="0 0 21 21" xmlns="http://www.w3.org/2000/svg"> |
| 61 | <path d="m10.96 9.68 6.897-6.896M18.53 6.148V2.11h-4.037M9.279 2.11H7.597c-4.205 0-5.887 1.683-5.887 5.888v5.046c0 4.205 1.682 5.887 5.887 5.887h5.046c4.205 0 5.887-1.682 5.887-5.887v-1.682" stroke="#fff" stroke-width="1.261" stroke-linecap="round" stroke-linejoin="round" fill="none" /> |
| 62 | </svg> |
| 63 | </a> |
| 64 | </div> |
| 65 | </div> |
| 66 | |
| 67 | <div class="form-template-options-introduction"> |
| 68 | <strong> |
| 69 | <?php |
| 70 | _e('Form Template Options', 'give'); ?> |
| 71 | </strong> |
| 72 | <p class="give-field-description"><?php |
| 73 | _e( |
| 74 | 'Customize the form template using the options below. See those customizations at any time using the "Preview" button.', |
| 75 | 'give' |
| 76 | ); ?></p> |
| 77 | </div> |
| 78 | |
| 79 | <div class="form-template-options"> |
| 80 | <?php |
| 81 | /* @var Template $template */ |
| 82 | foreach ($registeredTemplates as $template) { |
| 83 | printf( |
| 84 | '<div class="template-options %1$s" data-id="%2$s">%3$s</div>', |
| 85 | $template->getID() . ($activatedTemplate === $template->getID() ? ' active' : ''), |
| 86 | $template->getID(), |
| 87 | AdminFormTemplateUtils::renderMetaboxSettings($template) |
| 88 | ); |
| 89 | } |
| 90 | ?> |
| 91 | </div> |
| 92 | </div> |
| 93 |