| 1 |
<?php |
| 2 |
/** |
| 3 |
* @package Polylang |
| 4 |
*/ |
| 5 |
|
| 6 |
namespace WP_Syntex\Polylang\Options\Business; |
| 7 |
|
| 8 |
use WP_Error; |
| 9 |
use WP_Syntex\Polylang\Options\Options; |
| 10 |
use WP_Syntex\Polylang\Options\Primitive\Abstract_Boolean; |
| 11 |
|
| 12 |
defined( 'ABSPATH' ) || exit; |
| 13 |
|
| 14 |
/** |
| 15 |
* Class defining the "Translate media" boolean option. |
| 16 |
* |
| 17 |
* @since 3.7 |
| 18 |
*/ |
| 19 |
class Media_Support extends Abstract_Boolean { |
| 20 |
/** |
| 21 |
* Returns option key. |
| 22 |
* |
| 23 |
* @since 3.7 |
| 24 |
* |
| 25 |
* @return string |
| 26 |
* |
| 27 |
* @phpstan-return 'media_support' |
| 28 |
*/ |
| 29 |
public static function key(): string { |
| 30 |
return 'media_support'; |
| 31 |
} |
| 32 |
|
| 33 |
/** |
| 34 |
* Adds information to the site health info array. |
| 35 |
* |
| 36 |
* @since 3.8 |
| 37 |
* |
| 38 |
* @param Options $options An instance of the Options class providing additional configuration. |
| 39 |
* |
| 40 |
* @return array The updated site health information. |
| 41 |
*/ |
| 42 |
public function get_site_health_info( Options $options ): array { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
| 43 |
if ( $this->get() ) { |
| 44 |
$value = '1: ' . __( 'The media are translated', 'polylang' ); |
| 45 |
} else { |
| 46 |
$value = '0: ' . __( 'The media are not translated', 'polylang' ); |
| 47 |
} |
| 48 |
|
| 49 |
return $this->format_single_value_for_site_health_info( $value ); |
| 50 |
} |
| 51 |
|
| 52 |
/** |
| 53 |
* Returns the description used in the JSON schema. |
| 54 |
* |
| 55 |
* @since 3.7 |
| 56 |
* |
| 57 |
* @return string |
| 58 |
*/ |
| 59 |
protected function get_description(): string { |
| 60 |
return sprintf( |
| 61 |
/* translators: %1$s and %2$s are "true/false" values. */ |
| 62 |
__( 'Translate media: %1$s to translate, %2$s otherwise.', 'polylang' ), |
| 63 |
'`true`', |
| 64 |
'`false`' |
| 65 |
); |
| 66 |
} |
| 67 |
} |
| 68 |
|