PluginProbe
Polylang / 3.8.8
Polylang v3.8.8
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 / src / Capabilities / Create / Abstract_Object.php

Abstract_Object.php in Polylang 3.8.8, at src/Capabilities/Create/Abstract_Object.php

65 lines 1.3 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\Capabilities\Create;
7
8 use PLL_Model;
9 use PLL_Language;
10 use WP_Syntex\Polylang\REST\Request;
11
12 /**
13 * Class to manage the language context for posts creation or update.
14 *
15 * @since 3.8
16 */
17 abstract class Abstract_Object {
18 /**
19 * @var PLL_Model
20 */
21 protected $model;
22
23 /**
24 * @var PLL_Language|null
25 */
26 protected $pref_lang;
27
28 /**
29 * @var PLL_Language|null
30 */
31 protected $curlang;
32
33 /**
34 * @var Request
35 */
36 protected $request;
37
38 /**
39 * Constructor.
40 *
41 * @since 3.8
42 *
43 * @param PLL_Model $model The model instance.
44 * @param Request $request The request instance.
45 * @param PLL_Language|null $pref_lang The preferred language.
46 * @param PLL_Language|null $curlang The current language.
47 */
48 public function __construct( PLL_Model $model, Request $request, ?PLL_Language $pref_lang, ?PLL_Language $curlang ) {
49 $this->model = $model;
50 $this->request = $request;
51 $this->pref_lang = $pref_lang;
52 $this->curlang = $curlang;
53 }
54
55 /**
56 * Returns the language to set for an object creation or update based on the global context.
57 *
58 * @since 3.8
59 *
60 * @param int $id The object ID.
61 * @return PLL_Language The language defined from the global context.
62 */
63 abstract public function get_language( int $id = 0 ): PLL_Language;
64 }
65