admin-metabox-sub-fields.html.php
1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<div id="nf-sub-fields">
<table class="nf-sub-custom-fields-table">
<thead>
<tr>
<th><?php esc_html_e( 'Field', 'ninja-forms' ); ?></th>
<th><?php esc_html_e( 'Value', 'ninja-forms' ); ?></th>
</tr>
</thead>
<tbody>
<?php foreach( $fields as $field ): ?>
<?php if( in_array( $field->get_setting( 'type' ), $hidden_field_types ) ) continue; ?>
<?php if( ! isset( Ninja_Forms()->fields[ $field->get_setting( 'type' ) ] ) ) continue; ?>
<?php $field_class = Ninja_Forms()->fields[ $field->get_setting( 'type' ) ]; ?>
<?php if( ! $field_class ) continue; ?>
<tr>
<td><?php echo ( $field->get_setting( 'admin_label' ) ) ? $field->get_setting( 'admin_label' ) : $field->get_setting( 'label' ) ; ?></td>
<td><?php echo $field_class->admin_form_element( $field->get_id(), $sub->get_field_value( $field->get_id() ) ); ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<!-- TODO: Move to Style Sheet -->
<style>
.nf-sub-custom-fields-table {
width: 100%;
border-spacing: 0;
}
.nf-sub-custom-fields-table thead {
background-color: #f1f1f1;
}
.nf-sub-custom-fields-table thead th {
text-align: left;
}
.nf-sub-custom-fields-table th,
.nf-sub-custom-fields-table td {
padding: 10px 0 10px 10px;
vertical-align: top;
}
.nf-sub-custom-fields-table textarea {
height: 150px;
}
</style>
</div>