|
1 | 1 | <?php |
2 | 2 | /** |
3 | | - * Allow :admin modifier in {all_fields} merge tag to affect displayed nested form. |
4 | | - * IMPORTANT: Make sure the file name is "nested-entries-detail.php". |
5 | | - * Usage: Place this file in your current active theme structure. |
6 | | - * |
7 | | - * @var array $nested_fields An array of GF_Field objects. |
8 | | - * @var array $nested_form The form object of the nested form. |
9 | | - * @var array $nested_field_ids An array of nested field IDs. |
10 | | - * @var array $entries An array of child entries submitted from the current Nested Form field. |
11 | | - * @var array $labels An array of labels used in this template. |
12 | | - * @var array $actions An array of HTML strings used to display field actions. |
13 | | - * @var array $args An array of arguments passed to the template. |
| 3 | + * We're no longer using the experimental folder for experimental snippets. 🚧 |
| 4 | + * You can now find the snippet here: |
| 5 | + * https://github.com/gravitywiz/snippet-library/blob/master/gp-nested-forms/gpnf-admin-merge-tag-modifier-template.php |
14 | 6 | */ |
15 | | -?> |
16 | | -<div class="gpnf-nested-entries-container gpnf-entry-view ginput_container"> |
17 | | - |
18 | | - <table class="gpnf-nested-entries"> |
19 | | - |
20 | | - <thead> |
21 | | - <tr> |
22 | | - <?php foreach ( $nested_fields as $nested_field ) : ?> |
23 | | - <th class="gpnf-field-<?php echo $nested_field['id']; ?>"> |
24 | | - <?php |
25 | | - if ( rgar( $args, 'modifiers' ) && strpos( $args['modifiers'], 'admin' ) !== false ) { |
26 | | - $nested_field->set_context_property( 'use_admin_label', true ); |
27 | | - } |
28 | | - ?> |
29 | | - <?php echo GFCommon::get_label( $nested_field ); ?> |
30 | | - </th> |
31 | | - <?php endforeach; ?> |
32 | | - <th class="gpnf-row-actions"> </th> |
33 | | - </tr> |
34 | | - </thead> |
35 | | - |
36 | | - <tbody> |
37 | | - <?php foreach ( $entries as $entry ) : ?> |
38 | | - <?php $field_values = gp_nested_forms()->get_entry_display_values( $entry, $nested_form, $nested_field_ids ); ?> |
39 | | - <tr> |
40 | | - <?php |
41 | | - foreach ( $nested_fields as $nested_field ) : |
42 | | - $field_value = rgars( $field_values, "{$nested_field['id']}/label" ); |
43 | | - ?> |
44 | | - <td class="gpnf-field" |
45 | | - data-heading="<?php echo GFCommon::get_label( $nested_field ); ?>" |
46 | | - data-value="<?php echo esc_attr( $field_value ); ?>"> |
47 | | - <?php echo $field_value; ?> |
48 | | - </td> |
49 | | - <?php endforeach; ?> |
50 | | - <!-- The whitespace below matters. Using CSS :empty to hide when link is not output. --> |
51 | | - <td class="gpnf-row-actions"><?php if ( ! empty( $labels['view_entry'] ) ) : ?> |
52 | | - <a href="<?php echo gp_nested_forms()->get_entry_url( $entry['id'], $nested_form['id'] ); ?>"> |
53 | | - <?php echo $labels['view_entry']; ?> |
54 | | - </a> |
55 | | - <?php endif; ?></td> |
56 | | - </tr> |
57 | | - <?php endforeach; ?> |
58 | | - </tbody> |
59 | | - |
60 | | - </table> |
61 | | - |
62 | | - <div class="gpnf-actions"> |
63 | | - <?php echo implode( ' | ', $actions ); ?> |
64 | | - </div> |
65 | | - |
66 | | -</div> |
0 commit comments