# polylang/3.8.6/src/Capabilities/Create/Abstract_Object.php

Polylang, version 3.8.6. 65 lines.

- Page: https://pluginprobe.com/plugins/polylang/3.8.6/code/src/Capabilities/Create/Abstract_Object.php
- Raw: https://pluginprobe.com/plugins/polylang/3.8.6/raw/src/Capabilities/Create/Abstract_Object.php
- Modified: 2026-02-23T14:05:20+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/polylang/3.8.6/code/src/Capabilities/Create/Abstract_Object.php#L10-L20`.

```php
<?php
/**
 * @package Polylang
 */

namespace WP_Syntex\Polylang\Capabilities\Create;

use PLL_Model;
use PLL_Language;
use WP_Syntex\Polylang\REST\Request;

/**
 * Class to manage the language context for posts creation or update.
 *
 * @since 3.8
 */
abstract class Abstract_Object {
	/**
	 * @var PLL_Model
	 */
	protected $model;

	/**
	 * @var PLL_Language|null
	 */
	protected $pref_lang;

	/**
	 * @var PLL_Language|null
	 */
	protected $curlang;

	/**
	 * @var Request
	 */
	protected $request;

	/**
	 * Constructor.
	 *
	 * @since 3.8
	 *
	 * @param PLL_Model         $model     The model instance.
	 * @param Request           $request   The request instance.
	 * @param PLL_Language|null $pref_lang The preferred language.
	 * @param PLL_Language|null $curlang   The current language.
	 */
	public function __construct( PLL_Model $model, Request $request, ?PLL_Language $pref_lang, ?PLL_Language $curlang ) {
		$this->model     = $model;
		$this->request   = $request;
		$this->pref_lang = $pref_lang;
		$this->curlang   = $curlang;
	}

	/**
	 * Returns the language to set for an object creation or update based on the global context.
	 *
	 * @since 3.8
	 *
	 * @param int $id The object ID.
	 * @return PLL_Language The language defined from the global context.
	 */
	abstract public function get_language( int $id = 0 ): PLL_Language;
}

```
