|
18 | 18 | $label = $tax_object->labels->singular_name; |
19 | 19 | ?> |
20 | 20 | <?php foreach ( $this->taxonomy_fields as $context => $set ) : ?> |
21 | | - <tr> |
22 | | - <td colspan="2"> |
23 | | - <h3> |
24 | | - <?php |
25 | | - echo esc_html( |
26 | | - sprintf( |
27 | | - // translators: The taxonomy label and the context. |
28 | | - __( 'Cloudinary %1$s %2$s Transformations', 'cloudinary' ), |
29 | | - $label, |
30 | | - ucwords( $context ) |
31 | | - ) |
32 | | - ); |
33 | | - ?> |
34 | | - </h3> |
35 | | - </td> |
36 | | - </tr> |
37 | | - <?php foreach ( $set as $setting ) : ?> |
38 | | - <tr class="form-field term-<?php echo esc_attr( $setting->get_slug() ); ?>-wrap"> |
39 | | - <th scope="row"> |
40 | | - <label for="cloudinary_<?php echo esc_attr( $setting->get_slug() ); ?>"><?php echo esc_html( $setting->get_param( 'title' ) ); ?></label> |
41 | | - </th> |
42 | | - <td> |
43 | | - <?php $setting->set_param( 'title', null ); ?> |
44 | | - <?php $setting->set_param( 'tooltip_text', null ); ?> |
45 | | - <?php $setting->get_component()->render( true ); ?> |
| 21 | + <?php |
| 22 | + $collapse_id = 'cld-collapse-' . sanitize_html_class( $context ); |
| 23 | + $heading = sprintf( |
| 24 | + // translators: The taxonomy label and the context. |
| 25 | + __( 'Cloudinary %1$s %2$s Transformations', 'cloudinary' ), |
| 26 | + $label, |
| 27 | + ucwords( $context ) |
| 28 | + ); |
| 29 | + // translators: The transformation context (e.g. Image, Video). |
| 30 | + $toggle_label = sprintf( __( 'Toggle %s transformations', 'cloudinary' ), ucwords( $context ) ); |
| 31 | + ?> |
| 32 | + <tbody class="cloudinary-term-transformations"> |
| 33 | + <tr> |
| 34 | + <td colspan="2"> |
| 35 | + <div class="cloudinary-collapsible__toggle" data-collapsible-target="<?php echo esc_attr( $collapse_id ); ?>"> |
| 36 | + <h3><?php echo esc_html( $heading ); ?></h3> |
| 37 | + <button |
| 38 | + type="button" |
| 39 | + aria-expanded="false" |
| 40 | + aria-controls="<?php echo esc_attr( $collapse_id ); ?>" |
| 41 | + aria-label="<?php echo esc_attr( $toggle_label ); ?>" |
| 42 | + ><i class="dashicons dashicons-arrow-down-alt2"></i></button> |
| 43 | + </div> |
46 | 44 | </td> |
47 | 45 | </tr> |
48 | | - <?php endforeach; ?> |
| 46 | + </tbody> |
| 47 | + <tbody id="<?php echo esc_attr( $collapse_id ); ?>" hidden class="cloudinary-term-transformations"> |
| 48 | + <?php foreach ( $set as $setting ) : ?> |
| 49 | + <tr class="form-field term-<?php echo esc_attr( $setting->get_slug() ); ?>-wrap"> |
| 50 | + <th scope="row"> |
| 51 | + <label for="cloudinary_<?php echo esc_attr( $setting->get_slug() ); ?>"><?php echo esc_html( $setting->get_param( 'title' ) ); ?></label> |
| 52 | + </th> |
| 53 | + <td> |
| 54 | + <?php $setting->set_param( 'title', null ); ?> |
| 55 | + <?php $setting->set_param( 'tooltip_text', null ); ?> |
| 56 | + <?php $setting->get_component()->render( true ); ?> |
| 57 | + </td> |
| 58 | + </tr> |
| 59 | + <?php endforeach; ?> |
| 60 | + </tbody> |
49 | 61 | <?php endforeach; ?> |
0 commit comments