| 1 |
<?php |
| 2 |
|
| 3 |
namespace Yoast\WP\SEO\Helpers\Schema; |
| 4 |
|
| 5 |
/** |
| 6 |
* Class Language_Helper. |
| 7 |
*/ |
| 8 |
class Language_Helper { |
| 9 |
|
| 10 |
/** |
| 11 |
* Adds the `inLanguage` property to a Schema piece. |
| 12 |
* |
| 13 |
* Must use one of the language codes from the IETF BCP 47 standard. The |
| 14 |
* language tag syntax is made of one or more subtags separated by a hyphen |
| 15 |
* e.g. "en", "en-US", "zh-Hant-CN". |
| 16 |
* |
| 17 |
* @param array $data The Schema piece data. |
| 18 |
* |
| 19 |
* @return array The Schema piece data with added language property |
| 20 |
*/ |
| 21 |
public function add_piece_language( $data ) { |
| 22 |
/** |
| 23 |
* Filter: 'wpseo_schema_piece_language' - Allow changing the Schema piece language. |
| 24 |
* |
| 25 |
* @param string $type The Schema piece language. |
| 26 |
* @param array $data The Schema piece data. |
| 27 |
*/ |
| 28 |
$data['inLanguage'] = \apply_filters( 'wpseo_schema_piece_language', \get_bloginfo( 'language' ), $data ); |
| 29 |
|
| 30 |
return $data; |
| 31 |
} |
| 32 |
} |
| 33 |
|