GravityView  2.10.1
The best, easiest way to display Gravity Forms entries on your website.
select-template.php
Go to the documentation of this file.
1 <?php
2 /**
3  * @file select-template.php
4  * @package GravityView
5  * @subpackage Gravityview/admin/metaboxes/partials
6  * @global WP_Post $post
7  */
8 
9 global $post;
10 
11 // Use nonce for verification
12 wp_nonce_field( 'gravityview_select_template', 'gravityview_select_template_nonce' );
13 
14 //current value
16 
18 
19 // current input
20 ?>
21 <input type="hidden" id="gravityview_directory_template" name="gravityview_directory_template" value="<?php echo esc_attr( $current_template ); ?>" />
22 
23 <div class="gv-view-template-notice notice inline error hidden">
24  <p><!-- Contents will be replaced by JavaScript if there is an error --></p>
25 </div>
26 
27 <?php // list all the available templates (type= fresh or custom ) ?>
28 <div class="gv-grid">
29  <?php foreach( $templates as $id => $template ) {
30  $selected = ( $id == $current_template ) ? ' gv-selected' : '';
31  $placeholder = ! empty( $template['buy_source'] );
32  $is_included = ! empty( $template['included'] );
33  $plugin_data = GravityView_Admin_Installer::get_wp_plugins_data( \GV\Utils::get( $template, 'textdomain', '' ) );
34  $button_text = empty( $plugin_data ) ? esc_html__( 'Install Layout', 'gravityview' ) : esc_html__( 'Activate & Select Layout', 'gravityview' );
35  $button_class = 'gv-layout-' . ( empty( $plugin_data ) ? 'install' : 'activate' );
36  $template_path = isset($plugin_data['path']) ? $plugin_data['path'] : '';
37 
38  ?>
39  <div class="gv-grid-col-1-4">
40  <div class="gv-view-types-module<?php echo $selected; if( $placeholder ) { echo ' gv-view-template-placeholder'; } ?>" data-filter="<?php echo esc_attr( $template['type'] ); ?>">
41  <div class="gv-view-types-normal">
42  <img src="<?php echo esc_url( $template['logo'] ); ?>" alt="<?php echo esc_attr( $template['label'] ); ?>">
43  <h5><?php echo esc_html( $template['label'] ); ?></h5>
44  <p class="description"><?php echo esc_html( $template['description'] ); ?></p>
45  </div>
46  <div class="gv-view-types-hover">
47  <div>
48  <?php
49  if( $is_included ) {
50  ?>
51  <p><a href="<?php echo esc_url( admin_url( 'edit.php?post_type=gravityview&page=gv-admin-installer' ) ); ?>" class="button button-secondary button-hero <?php echo $button_class; ?>" rel="internal" data-template-path="<?php echo $template_path; ?>"><?php echo $button_text; ?></a></p>
52  <?php if( !empty( $template['license'] ) ) { ?>
53  <p class="gv-included-in"><?php echo sprintf( esc_html__( 'This layout is included in the %s license.', 'gravityview' ), esc_html( str_replace( ' ', '&nbsp;', $template['license'] ) ) ); ?></p>
54  <?php } ?>
55  <?php
56  } elseif( $placeholder ) {
57  $utm_string = '?utm_source=plugin&utm_medium=buy_now&utm_campaign=view_type&utm_term=' . urlencode( $template['license'] ) . '&utm_content=' . urlencode( $template['slug'] );
58  ?>
59  <p><a href="<?php echo esc_url( $template['buy_source'] ); ?>" class="button button-primary button-hero" rel="noreferrer noopener external"><?php esc_html_e( 'Buy Now', 'gravityview'); ?></a></p>
60 
61  <?php if( !empty( $template['preview'] ) ) { ?>
62  <p><a href="<?php echo esc_url( $template['preview'] ); ?>" rel="noreferrer noopener external" class="button button-secondary"><i class="dashicons dashicons-external" style="vertical-align: middle;" title="<?php esc_html_e( 'View a live demo of this layout', 'gravityview'); ?>"></i> <?php esc_html_e( 'Try a demo', 'gravityview' ); ?></a></p>
63  <?php } ?>
64 
65  <?php if( ! empty( $template['license'] ) ) { ?>
66  <p class="gv-included-in"><?php echo sprintf( esc_html__( 'This layout is included in the %s license.', 'gravityview' ), '<a href="https://gravityview.co/pricing/' . esc_attr( $utm_string ) . '" rel="noreferrer noopener external">' . esc_html( str_replace( ' ', '&nbsp;', $template['license'] ) ) . '</a>' ); ?></p>
67  <?php } ?>
68  <?php }
69 
70  if ($placeholder || $is_included) { ?> </div><div class="hidden"> <?php } ?>
71 
72  <p><a href="#gv_select_template" role="button" class="gv_select_template button button-hero button-primary" data-templateid="<?php echo esc_attr( $id ); ?>"><?php esc_html_e( 'Select', 'gravityview'); ?></a></p>
73  <?php if( !empty( $template['preview'] ) ) { ?>
74  <a href="<?php echo esc_url( $template['preview'] ); ?>" rel="external" class="gv-site-preview"><i class="dashicons dashicons-admin-links" title="<?php esc_html_e( 'View a live demo of this preset', 'gravityview'); ?>"></i></a>
75  <?php } ?>
76  </div>
77  </div>
78  </div>
79  </div>
80  <?php } ?>
81 </div>
static get_wp_plugins_data( $textdomain=null)
Get an array of plugins with textdomains as keys.
if(! isset( $gravityview)||empty( $gravityview->template)) $template
The entry loop for the list output.
$templates
get( $key, $default=null)
Retrieve a setting.
$current_template
gravityview_get_registered_templates()
Get all available preset templates.
global $post
gravityview_get_template_id( $post_id)
Get the template ID (list, table, datatables, map) for a View.