-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathtaxonomy-term-transformation-fields.php
More file actions
38 lines (36 loc) · 1.29 KB
/
taxonomy-term-transformation-fields.php
File metadata and controls
38 lines (36 loc) · 1.29 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
<?php
/**
* Edit term, global transformations template.
*
* @package Cloudinary
*/
wp_enqueue_style( 'cld-player' );
wp_enqueue_script( 'cld-player' );
$transformations = array(
'image' => $this->get_transformations( 'image' ),
'video' => $this->get_transformations( 'video' ),
);
wp_add_inline_script( 'cloudinary', 'var CLD_GLOBAL_TRANSFORMATIONS = CLD_GLOBAL_TRANSFORMATIONS ? CLD_GLOBAL_TRANSFORMATIONS : {};', 'before' );
?>
<tr>
<td colspan="2"><h2><?php esc_html_e( 'Global Transformations', 'cloudinary' ); ?></h2></td>
</tr>
<?php foreach ( $this->fields as $field_slug => $field ) : ?>
<tr class="form-field term-<?php echo esc_attr( $field_slug ); ?>-wrap">
<th scope="row">
<label for="cloudinary_<?php echo esc_attr( $field_slug ); ?>"><?php echo esc_html( $field['label'] ); ?></label>
</th>
<td>
<?php
$field['slug'] = $field_slug;
$field['label_for'] = 'field-' . $field['slug'];
// Ensure the index exists in the transformation array.
if ( ! isset( $transformations[ $field['context'] ][ $field_slug ] ) ) {
$transformations[ $field['context'] ][ $field_slug ] = null;
}
// Render Field.
$this->media->plugin->components['settings']->render_field( $field, $transformations[ $field['context'] ][ $field_slug ] );
?>
</td>
</tr>
<?php endforeach;