Use icons instead of yes/no

For consistency with WC and to avoid translation
This commit is contained in:
Alex P 2021-11-25 11:55:09 +02:00
parent 5322f101b4
commit fc20b05de8
2 changed files with 14 additions and 14 deletions

View file

@ -41,7 +41,7 @@ class Renderer {
<?php echo esc_attr( $item['label'] ); ?> <?php echo esc_attr( $item['label'] ); ?>
</td> </td>
<td class="help"><?php echo wc_help_tip( $item['description'] ); ?></td> <td class="help"><?php echo wc_help_tip( $item['description'] ); ?></td>
<td><?php echo esc_attr( $item['value'] ); ?></td> <td><?php echo wp_kses_post( $item['value'] ); ?></td>
</tr> </tr>
<?php <?php
} }

View file

@ -82,7 +82,7 @@ class StatusReportModule implements ModuleInterface {
'label' => esc_html__( 'Onboarded', 'woocommerce-paypal-payments' ), 'label' => esc_html__( 'Onboarded', 'woocommerce-paypal-payments' ),
'exported_label' => 'Onboarded', 'exported_label' => 'Onboarded',
'description' => esc_html__( 'Whether PayPal account is correctly configured or not.', 'woocommerce-paypal-payments' ), 'description' => esc_html__( 'Whether PayPal account is correctly configured or not.', 'woocommerce-paypal-payments' ),
'value' => $this->bool_to_text( 'value' => $this->bool_to_html(
$this->onboarded( $bearer, $state ) $this->onboarded( $bearer, $state )
), ),
), ),
@ -96,7 +96,7 @@ class StatusReportModule implements ModuleInterface {
'label' => esc_html__( 'WooCommerce currency supported', 'woocommerce-paypal-payments' ), 'label' => esc_html__( 'WooCommerce currency supported', 'woocommerce-paypal-payments' ),
'exported_label' => 'WooCommerce currency supported', 'exported_label' => 'WooCommerce currency supported',
'description' => esc_html__( 'Whether PayPal supports the default store currency or not.', 'woocommerce-paypal-payments' ), 'description' => esc_html__( 'Whether PayPal supports the default store currency or not.', 'woocommerce-paypal-payments' ),
'value' => $this->bool_to_text( 'value' => $this->bool_to_html(
$currency_support->supports_wc_currency() $currency_support->supports_wc_currency()
), ),
), ),
@ -104,7 +104,7 @@ class StatusReportModule implements ModuleInterface {
'label' => esc_html__( 'PayPal card processing available in country', 'woocommerce-paypal-payments' ), 'label' => esc_html__( 'PayPal card processing available in country', 'woocommerce-paypal-payments' ),
'exported_label' => 'PayPal card processing available in country', 'exported_label' => 'PayPal card processing available in country',
'description' => esc_html__( 'Whether PayPal card processing is available in country or not.', 'woocommerce-paypal-payments' ), 'description' => esc_html__( 'Whether PayPal card processing is available in country or not.', 'woocommerce-paypal-payments' ),
'value' => $this->bool_to_text( 'value' => $this->bool_to_html(
$dcc_applies->for_country_currency() $dcc_applies->for_country_currency()
), ),
), ),
@ -112,7 +112,7 @@ class StatusReportModule implements ModuleInterface {
'label' => esc_html__( 'Pay Later messaging available in country', 'woocommerce-paypal-payments' ), 'label' => esc_html__( 'Pay Later messaging available in country', 'woocommerce-paypal-payments' ),
'exported_label' => 'Pay Later messaging available in country', 'exported_label' => 'Pay Later messaging available in country',
'description' => esc_html__( 'Whether Pay Later is available in country or not.', 'woocommerce-paypal-payments' ), 'description' => esc_html__( 'Whether Pay Later is available in country or not.', 'woocommerce-paypal-payments' ),
'value' => $this->bool_to_text( 'value' => $this->bool_to_html(
$messages_apply->for_country() $messages_apply->for_country()
), ),
), ),
@ -120,13 +120,13 @@ class StatusReportModule implements ModuleInterface {
'label' => esc_html__( 'Webhook status', 'woocommerce-paypal-payments' ), 'label' => esc_html__( 'Webhook status', 'woocommerce-paypal-payments' ),
'exported_label' => 'Webhook status', 'exported_label' => 'Webhook status',
'description' => esc_html__( 'Whether we received webhooks successfully.', 'woocommerce-paypal-payments' ), 'description' => esc_html__( 'Whether we received webhooks successfully.', 'woocommerce-paypal-payments' ),
'value' => $last_webhook_storage->is_empty() ? 'Unknown' : 'OK', 'value' => $this->bool_to_html( ! $last_webhook_storage->is_empty() ),
), ),
array( array(
'label' => esc_html__( 'Vault enabled', 'woocommerce-paypal-payments' ), 'label' => esc_html__( 'Vault enabled', 'woocommerce-paypal-payments' ),
'exported_label' => 'Vault enabled', 'exported_label' => 'Vault enabled',
'description' => esc_html__( 'Whether vaulting is enabled on PayPal account or not.', 'woocommerce-paypal-payments' ), 'description' => esc_html__( 'Whether vaulting is enabled on PayPal account or not.', 'woocommerce-paypal-payments' ),
'value' => $this->bool_to_text( 'value' => $this->bool_to_html(
$this->vault_enabled( $bearer ) $this->vault_enabled( $bearer )
), ),
), ),
@ -134,7 +134,7 @@ class StatusReportModule implements ModuleInterface {
'label' => esc_html__( 'Logging enabled', 'woocommerce-paypal-payments' ), 'label' => esc_html__( 'Logging enabled', 'woocommerce-paypal-payments' ),
'exported_label' => 'Logging enabled', 'exported_label' => 'Logging enabled',
'description' => esc_html__( 'Whether logging of plugin events and errors is enabled.', 'woocommerce-paypal-payments' ), 'description' => esc_html__( 'Whether logging of plugin events and errors is enabled.', 'woocommerce-paypal-payments' ),
'value' => $this->bool_to_text( 'value' => $this->bool_to_html(
$settings->has( 'logging_enabled' ) && $settings->get( 'logging_enabled' ) $settings->has( 'logging_enabled' ) && $settings->get( 'logging_enabled' )
), ),
), ),
@ -142,7 +142,7 @@ class StatusReportModule implements ModuleInterface {
'label' => esc_html__( 'Reference Transactions', 'woocommerce-paypal-payments' ), 'label' => esc_html__( 'Reference Transactions', 'woocommerce-paypal-payments' ),
'exported_label' => 'Reference Transactions', 'exported_label' => 'Reference Transactions',
'description' => esc_html__( 'Whether Reference Transactions are enabled for the connected account', 'woocommerce-paypal-payments' ), 'description' => esc_html__( 'Whether Reference Transactions are enabled for the connected account', 'woocommerce-paypal-payments' ),
'value' => $this->bool_to_text( 'value' => $this->bool_to_html(
$this->reference_transaction_enabled( $billing_agreements_endpoint ) $this->reference_transaction_enabled( $billing_agreements_endpoint )
), ),
), ),
@ -150,7 +150,7 @@ class StatusReportModule implements ModuleInterface {
'label' => esc_html__( 'Used PayPal Checkout plugin', 'woocommerce-paypal-payments' ), 'label' => esc_html__( 'Used PayPal Checkout plugin', 'woocommerce-paypal-payments' ),
'exported_label' => 'Used PayPal Checkout plugin', 'exported_label' => 'Used PayPal Checkout plugin',
'description' => esc_html__( 'Whether the PayPal Checkout Gateway plugin was configured previously or not', 'woocommerce-paypal-payments' ), 'description' => esc_html__( 'Whether the PayPal Checkout Gateway plugin was configured previously or not', 'woocommerce-paypal-payments' ),
'value' => $this->bool_to_text( 'value' => $this->bool_to_html(
$had_ppec_plugin $had_ppec_plugin
), ),
), ),
@ -218,14 +218,14 @@ class StatusReportModule implements ModuleInterface {
} }
/** /**
* Converts the bool value to "Yes" or "No". * Converts the bool value to "yes" icon or dash.
* *
* @param bool $value The value. * @param bool $value The value.
* @return string * @return string
*/ */
private function bool_to_text( bool $value ): string { private function bool_to_html( bool $value ): string {
return $value return $value
? esc_html__( 'Yes', 'woocommerce-paypal-payments' ) ? '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>'
: esc_html__( 'No', 'woocommerce-paypal-payments' ); : '<mark class="no">&ndash;</mark>';
} }
} }