auto-template
4 months ago
element-pod_reference-content.php
4 months ago
element-pod_reference.php
4 months ago
element-view_template.php
4 months ago
functions-pod_reference.php
4 months ago
functions-view_template.php
4 months ago
element-pod_reference.php
46 lines
| 1 | <?php |
| 2 | |
| 3 | // Don't load directly. |
| 4 | if ( ! defined( 'ABSPATH' ) ) { |
| 5 | die( '-1' ); |
| 6 | } |
| 7 | |
| 8 | // phpcs:ignoreFile WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound |
| 9 | ?> |
| 10 | <div class="pod-queries-tools"><?php |
| 11 | |
| 12 | $defaults = array( |
| 13 | 'pod' => '', |
| 14 | ); |
| 15 | if ( empty( $atts ) ) { |
| 16 | $atts = $defaults; |
| 17 | } else { |
| 18 | $atts = wp_parse_args( $atts, $defaults ); |
| 19 | } |
| 20 | |
| 21 | $api = pods_api(); |
| 22 | $_pods = $api->load_pods(); |
| 23 | echo '<select name="pod_reference[pod]" id="pod-reference" class="pod-switch" data-template="#podref-tmpl" data-target="#pods-magic-tag-list" data-action="pq_loadpod" data-event="change" />'; |
| 24 | echo '<option value="">' . esc_html__( 'Select Pod to use as reference', 'pods' ) . '</option>'; |
| 25 | foreach ( $_pods as $pod ) { |
| 26 | echo '<option value="' . esc_attr( $pod['name'] ) . '" ' . ( $atts['pod'] == $pod['name'] ? 'selected="selected"' : '' ) . '>' . esc_html( $pod['label'] ) . '</option>'; |
| 27 | } |
| 28 | echo '</select>'; |
| 29 | ?></div> |
| 30 | <div id="pod-reference-wrapper" class="pod-reference-wrapper"> |
| 31 | <?php include_once __DIR__ . '/element-pod_reference-content.php'; ?> |
| 32 | </div> |
| 33 | <script id="podref-tmpl" type="text/html"> |
| 34 | {{#if this.length}} |
| 35 | <dl> |
| 36 | <dt><?php esc_html_e( 'Available magic tags', 'pods' ); ?></dt> |
| 37 | <dd><em><?php esc_html_e( 'You can click to copy any tag', 'pods' ); ?></em></dd> |
| 38 | {{#each this}} |
| 39 | <dd class="pods-magic-tag-option" data-tag="{{this}}" title="<?php esc_attr_e( 'Field', 'pods' ); ?>: {{this}}"> |
| 40 | <span>{{this}}</span> |
| 41 | </dd> |
| 42 | {{/each}} |
| 43 | </dl> |
| 44 | {{/if}} |
| 45 | </script> |
| 46 |