wpml / core-api
Class and utilities to interface with WPML core functionality
Requires
- psr/log: ^1.1
Requires (Dev)
- 10up/wp_mock: 0.2.0
- antecedent/patchwork: ^2.0
- cvuorinen/phpdoc-markdown-public: ^0.2.0
- otgs/unit-tests-framework: ~1.2.0
- wpml/collect: dev-wpml-collect-rename
- wpml/fp: dev-develop
- wpml/wp: dev-develop
- dev-develop
- 0.1.14
- 0.1.13
- 0.1.12
- 0.1.11
- 0.1.10
- 0.1.9
- 0.1.8
- 0.1.7
- 0.1.6
- 0.1.5
- 0.1.4
- 0.1.3
- 0.1.2
- 0.1.1
- dev-wpml
- dev-preview/wpml-4-7-0-p0913
- dev-preview/wpml-4-7-0-p0920
- dev-wpml_temp-4-7-0-p0913
- dev-wpml_temp-4-7-0-p0920
- dev-wpmldev-3447-cc
- dev-preview/wpml-4-7-0-p0906
- dev-wpml_temp-4-7-0-p0906
- dev-wcml-4767
- dev-wpmldev-2341
- dev-release/0.1.9
- dev-wpmldev-1241
- dev-wpmldev-blog-waqas
- dev-christian/wpmlsystem-34
- dev-wpmlcore-9050
- dev-wpmlcore-8978-optimize
- dev-wpmlcore-7728-bruce
- dev-wpmlcore-7728
- dev-wpmltm-4226
- dev-pathOr
- dev-wpmlcore-7997
- dev-wpmlcore-7954
- dev-wpmlcore-7936
- dev-wpmlcore-7877
- dev-wpmlcore-7934
- dev-wpmlcore-7090-option
- dev-master
- dev-while-in-language
This package is auto-updated.
Last update: 2024-11-17 00:24:43 UTC
README
Table of Contents
IfOriginalPost
- Full name: \WPML\Element\API\IfOriginalPost
getTranslations
Gets the element details for the translations of the given post id.
IfOriginalPost::getTranslations( integer $id = null ): \WPML\Collect\Support\Collection|callable
Returns an empty array if the id is not an original post.
element details structure:
(object) [
'original' => false, // bool True if the element is the original, false if a translation
'element_id' => 123, // int The element id
'source_language_code' => 'en', // string The source language code
'language_code' => 'de', // string The language of the element
'trid' => 456, // int The translation id that links translations to source.
]
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$id | integer | The post id. Optional. If missing then returns a callable waiting for the id. |
getTranslationIds
Get the element ids for the translations of the given post id.
IfOriginalPost::getTranslationIds( integer $id = null ): \WPML\Collect\Support\Collection|callable
Returns an empty array if the id is not an original post.
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$id | integer | The post id. Optional. If missing then returns a callable waiting for the id. |
Languages
- Full name: \WPML\Element\API\Languages
getActive
Languages::getActive( ): array
It returns an array of the active languages.
The returned array is indexed by language code and every element has the following structure:
'fr' => [
'code' => 'fr',
'id' => 3,
'english_name' => 'French',
'native_name' => 'Français',
'major' => 1,
'default_locale' => 'fr_FR',
'encode_url' => 0,
'tag' => 'fr ,
'display_name' => 'French
]
- This method is static.
getFlagUrl
Languages::getFlagUrl( mixed $...$code ): callable|string
- Curried :: string → string
Gets the flag url for the given language code.
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$...$code | mixed |
withFlags
Languages::withFlags( mixed $...$langs ): callable|array
- Curried :: [code => lang] → [code => lang]
Adds the language flag url to the array of languages.
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$...$langs | mixed |
getAll
Languages::getAll( ): callable|array
void → [lang]
It returns an array of the all the languages.
The returned array is indexed by language code and every element has the following structure:
'fr' => [
'code' => 'fr',
'id' => 3,
'english_name' => 'French',
'native_name' => 'Français',
'major' => 1,
'default_locale' => 'fr_FR',
'encode_url' => 0,
'tag' => 'fr ,
'display_name' => 'French
]
- This method is static.
PostTranslations
Class PostTranslations
- Full name: \WPML\Element\API\PostTranslations
setAsSource
PostTranslations::setAsSource( mixed $...$el_id, mixed $...$language_code ): callable|integer
- Curried :: int → string → void
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$...$el_id | mixed | |
$...$language_code | mixed |
setAsTranslationOf
PostTranslations::setAsTranslationOf( mixed $...$el_id, mixed $...$translated_id, mixed $...$language_code ): callable|integer
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$...$el_id | mixed | |
$...$translated_id | mixed | |
$...$language_code | mixed |
get
PostTranslations::get( mixed $...$el_id ): callable|array
- Curried :: int → [object]
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$...$el_id | mixed |
getIfOriginal
PostTranslations::getIfOriginal( mixed $...$el_id ): callable|array
- Curried :: int → [object]
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$...$el_id | mixed |
Translations
Class Translations
- Full name: \WPML\Element\API\Translations
setLanguage
Translations::setLanguage( mixed $...$el_id, mixed $...$el_type, mixed $...$trid, mixed $...$language_code, mixed $...$src_language_code, mixed $...$check_duplicates ): callable|integer
Curried :: int → string → int|null → string → string → string|null → bool → bool|int|null|string
Wrapper function for SitePress::set_element_language_details
int $el_id the element's ID (for terms we use the
term_taxonomy_id
)- string $el_type
- int $trid
- string $language_code
- null|string $src_language_code
- bool $check_duplicates
returns bool|int|null|string
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$...$el_id | mixed | |
$...$el_type | mixed | |
$...$trid | mixed | |
$...$language_code | mixed | |
$...$src_language_code | mixed | |
$...$check_duplicates | mixed |
setAsSource
Translations::setAsSource( mixed $...$el_id, mixed $...$el_type, mixed $...$language_code ): callable|integer
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$...$el_id | mixed | |
$...$el_type | mixed | |
$...$language_code | mixed |
setAsTranslationOf
Translations::setAsTranslationOf( mixed $...$el_id, mixed $...$el_type, mixed $...$translated_id, mixed $...$language_code ): callable|integer
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$...$el_id | mixed | |
$...$el_type | mixed | |
$...$translated_id | mixed | |
$...$language_code | mixed |
get
Translations::get( mixed $...$el_id, mixed $...$el_type ): callable|array
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$...$el_id | mixed | |
$...$el_type | mixed |
getIfOriginal
Translations::getIfOriginal( mixed $...$el_id, mixed $...$el_type ): callable|array
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$...$el_id | mixed | |
$...$el_type | mixed |
isOriginal
Translations::isOriginal( mixed $...$el_id, mixed $...$translations ): callable|boolean
- This method is static. Parameters:
Parameter | Type | Description |
---|---|---|
$...$el_id | mixed | |
$...$translations | mixed |
This document was automatically generated from source code comments on 2020-06-28 using phpDocumentor and cvuorinen/phpdoc-markdown-public