PluginProbe
Polylang / 3.7
Polylang v3.7
3.8.9 3.8.8 3.8.7 3.8.6 3.8.5 3.8.4 3.8.3 2.7 2.7.0.1 2.7.1 2.7.2 2.7.3 2.7.4 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.9 2.9.1 2.9.2 3.0 3.0.1 3.0.2 3.0.3 All 233 releases
polylang / include / Options / Business / Force_Lang.php

Force_Lang.php in Polylang 3.7, at include/Options/Business/Force_Lang.php

69 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package Polylang
4 */
5
6 namespace WP_Syntex\Polylang\Options\Business;
7
8 use WP_Syntex\Polylang\Options\Abstract_Option;
9
10 defined( 'ABSPATH' ) || exit;
11
12 /**
13 * Class defining the "Determine how the current language is defined" option.
14 *
15 * @since 3.7
16 */
17 class Force_Lang extends Abstract_Option {
18 /**
19 * Returns option key.
20 *
21 * @since 3.7
22 *
23 * @return string
24 *
25 * @phpstan-return 'force_lang'
26 */
27 public static function key(): string {
28 return 'force_lang';
29 }
30
31 /**
32 * Returns the default value.
33 *
34 * @since 3.7
35 *
36 * @return int
37 */
38 protected function get_default() {
39 return 1;
40 }
41
42 /**
43 * Returns the JSON schema part specific to this option.
44 *
45 * @since 3.7
46 *
47 * @return array Partial schema.
48 *
49 * @phpstan-return array{type: 'integer', enum: list<0|1|2|3>|list<1|2|3>}
50 */
51 protected function get_data_structure(): array {
52 return array(
53 'type' => 'integer',
54 'enum' => 'yes' === get_option( 'pll_language_from_content_available' ) ? array( 0, 1, 2, 3 ) : array( 1, 2, 3 ),
55 );
56 }
57
58 /**
59 * Returns the description used in the JSON schema.
60 *
61 * @since 3.7
62 *
63 * @return string
64 */
65 protected function get_description(): string {
66 return __( 'Determine how the current language is defined.', 'polylang' );
67 }
68 }
69