Metabox-Settings.php
75 lines
| 1 | <?php |
| 2 | global $post; |
| 3 | |
| 4 | use Give\Form\Template; |
| 5 | use Give\Helpers\Form\Template as FormTemplateUtils; |
| 6 | use Give\Helpers\Form\Template\Utils\Admin as AdminFormTemplateUtils; |
| 7 | |
| 8 | $activatedTemplate = FormTemplateUtils::getActiveID( $post->ID ); |
| 9 | $registeredTemplates = Give()->templates->getTemplates(); |
| 10 | ?> |
| 11 | <div class="form_template_options_wrap inner-panel<?php echo $activatedTemplate ? ' has-activated-template' : ''; ?>"> |
| 12 | <strong class="templates-list-heading"><?php _e( 'Available Form Templates', 'give' ); ?></strong> |
| 13 | <div class="templates-list"> |
| 14 | <?php |
| 15 | /* @var Template $template */ |
| 16 | foreach ( $registeredTemplates as $template ) { |
| 17 | $isActive = $activatedTemplate === $template->getID(); |
| 18 | |
| 19 | printf( |
| 20 | '<div class="template-info %1$s" data-id="%2$s"> |
| 21 | <div class="template-image-container"> |
| 22 | <img class="template-image" src="%3$s"/> |
| 23 | </div> |
| 24 | <div class="action"> |
| 25 | <div class="template-name">%4$s <span class="badge">%5$s</span></div> |
| 26 | <button class="button %7$s">%6$s</button> |
| 27 | </div> |
| 28 | </div>', |
| 29 | $template->getID() . ( $isActive ? ' active' : '' ), |
| 30 | $template->getID(), |
| 31 | $template->getImage(), |
| 32 | $template->getName(), |
| 33 | __( 'active', 'give' ), |
| 34 | $isActive ? __( 'Deactivate', 'give' ) : __( 'Activate', 'give' ), |
| 35 | $isActive ? 'js-template--deactivate' : 'js-template--activate' |
| 36 | ); |
| 37 | } |
| 38 | ?> |
| 39 | </div> |
| 40 | |
| 41 | <div class="form-template-introduction"> |
| 42 | <p> |
| 43 | <?php _e( 'What Are Form Templates?', 'give' ); ?> |
| 44 | </p> |
| 45 | <p class="give-field-description form-template-description"><?php _e( 'Form Templates are built-in ways of changing the appearance of a GiveWP 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!', 'give' ); ?></p> |
| 46 | |
| 47 | <div class="form-template-notice give-notice notice notice-success inline"> |
| 48 | <img src="<?php echo esc_url( GIVE_PLUGIN_URL . 'assets/dist/images/give-icon-full-circle.svg' ); ?>" alt="<?php esc_html_e( 'GiveWP', 'give' ); ?>" class="give-logo" style="width:35px;" /> |
| 49 | <p><?php esc_html_e( 'Learn the ins and outs of creating the perfect Donation Form with GiveWP', 'give' ); ?></p> |
| 50 | <a href="http://docs.givewp.com/form-templates/" target="_blank" class="button"><?php _e( 'Learn More', 'give' ); ?> <span class="dashicons dashicons-external"></span></a> |
| 51 | </div> |
| 52 | </div> |
| 53 | |
| 54 | <div class="form-template-options-introduction"> |
| 55 | <strong> |
| 56 | <?php _e( 'Form Template Options', 'give' ); ?> |
| 57 | </strong> |
| 58 | <p class="give-field-description"><?php _e( 'Customize the form template using the options below. See those customizations at any time using the "Preview" button.', 'give' ); ?></p> |
| 59 | </div> |
| 60 | |
| 61 | <div class="form-template-options"> |
| 62 | <?php |
| 63 | /* @var Template $template */ |
| 64 | foreach ( $registeredTemplates as $template ) { |
| 65 | printf( |
| 66 | '<div class="template-options %1$s" data-id="%2$s">%3$s</div>', |
| 67 | $template->getID() . ( $activatedTemplate === $template->getID() ? ' active' : '' ), |
| 68 | $template->getID(), |
| 69 | AdminFormTemplateUtils::renderMetaboxSettings( $template ) |
| 70 | ); |
| 71 | } |
| 72 | ?> |
| 73 | </div> |
| 74 | </div> |
| 75 |