87 lines
3.1 KiB
PHP
87 lines
3.1 KiB
PHP
<?php
|
|
/**
|
|
* Settings row layout.
|
|
*
|
|
* @package WP_Smush
|
|
*
|
|
* @var \Smush\App\Abstract_Page $this
|
|
*
|
|
* @var string $name Setting name.
|
|
* @var bool $value Setting value.
|
|
* @var bool $disable Disabled status.
|
|
* @var bool $upsell Upsell status.
|
|
* @var bool $show_pro_tag Show pro tag status.
|
|
*/
|
|
|
|
use Smush\Core\Settings;
|
|
|
|
if ( ! defined( 'WPINC' ) ) {
|
|
die;
|
|
}
|
|
|
|
$default_settings = Settings::get_instance()->get_defaults();
|
|
$custom_fields = array(
|
|
'lossy' => 'bulk/lossy-level',
|
|
);
|
|
|
|
?>
|
|
|
|
<div class="sui-box-settings-row <?php echo $upsell ? 'sui-box-upsell-row' : ''; ?> <?php echo $disable && ! $upsell ? 'sui-disabled' : ''; ?> <?php echo esc_attr( $name ); ?>-settings-row" id="<?php echo esc_attr( $name ); ?>-settings-row">
|
|
<div class="sui-box-settings-col-1">
|
|
<span class="sui-settings-label <?php echo 'gutenberg' === $name ? 'sui-settings-label-with-tag' : ''; ?>">
|
|
<?php echo esc_html( Settings::get_setting_data( $name, 'short-label' ) ); ?>
|
|
<?php if ( ! empty( $show_pro_tag ) ) : ?>
|
|
<span class="sui-tag sui-tag-pro"><?php esc_html_e( 'Pro', 'wp-smushit' ); ?></span>
|
|
<?php endif; ?>
|
|
<?php do_action( 'smush_setting_column_tag', $name ); ?>
|
|
</span>
|
|
<span class="sui-description">
|
|
<?php echo wp_kses_post( Settings::get_setting_data( $name, 'desc' ) ); ?>
|
|
</span>
|
|
</div>
|
|
<div class="sui-box-settings-col-2" id="column-<?php echo esc_attr( $name ); ?>">
|
|
<?php if ( isset( $custom_fields[ $name ]) ) : ?>
|
|
<span style="font-weight:500" id="<?php echo esc_attr( $name . '-label' ); ?>" class="sui-toggle-label">
|
|
<?php echo esc_html( Settings::get_setting_data( $name, 'label' ) ); ?>
|
|
</span>
|
|
<div class="sui-form-field">
|
|
<?php
|
|
$template_part = $custom_fields[ $name ];
|
|
$this->view(
|
|
$template_part,
|
|
array(
|
|
'name' => $name,
|
|
)
|
|
);
|
|
?>
|
|
<!-- Print/Perform action in right setting column -->
|
|
<?php do_action( 'smush_setting_column_right_inside', $name ); ?>
|
|
</div>
|
|
<?php do_action( 'smush_setting_column_right_additional', $name ); ?>
|
|
<?php elseif ( isset( $default_settings[ $name ] ) ) : ?>
|
|
<div class="sui-form-field">
|
|
<label for="<?php echo esc_attr( $name ); ?>" class="sui-toggle">
|
|
<input
|
|
type="checkbox"
|
|
id="<?php echo esc_attr( $name ); ?>"
|
|
name="<?php echo esc_attr( $name ); ?>"
|
|
aria-labelledby="<?php echo esc_attr( $name . '-label' ); ?>"
|
|
aria-describedby="<?php echo esc_attr( $name . '-desc' ); ?>"
|
|
<?php checked( $value, 1, true ); ?>
|
|
<?php disabled( $disable ); ?>
|
|
/>
|
|
<span class="sui-toggle-slider" aria-hidden="true"></span>
|
|
<span id="<?php echo esc_attr( $name . '-label' ); ?>" class="sui-toggle-label">
|
|
<?php echo esc_html( Settings::get_setting_data( $name, 'label' ) ); ?>
|
|
</span>
|
|
<!-- Print/Perform action in right setting column -->
|
|
<?php do_action( 'smush_setting_column_right_inside', $name ); ?>
|
|
</label>
|
|
<?php do_action( 'smush_setting_column_right_additional', $name ); ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
<!-- Print/Perform action in right setting column -->
|
|
<?php do_action( 'smush_setting_column_right_outside', $name ); ?>
|
|
</div>
|
|
</div>
|