Skip to content

Commit 74e8f20

Browse files
author
Dukagjin Surdulli
committed
Only show transformations warning once in tax page
- Also changes the color of the warning to blue.
1 parent 735c00c commit 74e8f20

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

cloudinary-image-management-and-manipulation-in-the-cloud-cdn/css/src/components/_settings.scss

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,8 @@
212212
.settings-warning {
213213
display: inline-block;
214214
padding: 5px 7px;
215-
background-color: #ffea98;
216-
border-left: 4px solid #ffcc00;
217-
box-shadow: 0px 0px 5px 0px rgba(112,112,112,0.4);
215+
background-color: #e9faff;
216+
border: 1px solid #ccd0d4;
217+
border-left: 4px solid #00a0d2;
218+
box-shadow: 0 1px 1px rgba(0,0,0,.04);
218219
}

cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-settings-page.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ private function register_section( $tab_slug ) {
175175
*
176176
* @since 0.1
177177
*
178-
* @param string $tab The tab to register the section fields for.
178+
* @param array $tab The tab to register the section fields for.
179179
* @param string $setting_slug The slug of the setting to register section for.
180180
*/
181181
private function register_section_fields( $tab, $setting_slug ) {
@@ -226,8 +226,9 @@ public function render() {
226226
*
227227
* @param array $field The field to render.
228228
* @param string|null $value The value to render.
229+
* @param bool $show_description Whether to render the description.
229230
*/
230-
public function render_field( $field, $value = null ) {
231+
public function render_field( $field, $value = null, $show_description = true ) {
231232

232233
if ( null === $value ) {
233234
$value = $this->get_value( $field['slug'] );
@@ -308,7 +309,7 @@ public function render_field( $field, $value = null ) {
308309
<p class="description error-notice" id="<?php echo esc_attr( $setting_slug ); ?>-error"><?php echo wp_kses_post( $field['error_notice'] ); ?></p>
309310
<?php
310311
}
311-
if ( ! empty( $field['description'] ) ) {
312+
if ( ! empty( $field['description'] ) && $show_description ) {
312313
?>
313314
<p class="description" id="<?php echo esc_attr( $setting_slug ); ?>-description"><?php echo wp_kses_post( $field['description'] ); ?></p>
314315
<?php

cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/templates/taxonomy-transformation-fields.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
wp_enqueue_script( 'cld-player' );
99

1010
wp_add_inline_script( 'cloudinary', 'var CLD_GLOBAL_TRANSFORMATIONS = CLD_GLOBAL_TRANSFORMATIONS ? CLD_GLOBAL_TRANSFORMATIONS : {};', 'before' );
11+
$show_desc = true;
1112
?>
1213
<h2><?php esc_html_e( 'Global Transformations', 'cloudinary' ); ?></h2>
1314
<?php foreach ( $this->fields as $field_slug => $field ) : ?>
@@ -16,7 +17,8 @@
1617
<?php
1718
$field['slug'] = $field_slug;
1819
$field['label_for'] = 'field-' . $field['slug'];
19-
$this->media->plugin->components['settings']->render_field( $field );
20+
$this->media->plugin->components['settings']->render_field( $field, null, $show_desc );
21+
$show_desc = false;
2022
?>
2123
</div>
2224
<?php endforeach; ?>

0 commit comments

Comments
 (0)