- md5
- 74bf71339def1eb65668ef49fe617b09
- sha1
- 4945039bb0c2d552cb840335d7d0bb58f0d9e6a2
- sha256
- 0ae65d8ee216bddec5a69682d5af1e6b36e9cec2e4f2f2b7ff0f48b95f3e5566
<?php
/**
* Joomla! Content Management System
*
* @copyright (C) 2020 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\CMS\WebAsset\AssetItem;
use Joomla\CMS\Factory;
use Joomla\CMS\WebAsset\WebAssetItem;
/**
* Web Asset Item class for load asset file for active language.
* Used in core templates.
*
* @since 4.0.0
*/
class LangActiveAssetItem extends WebAssetItem
{
/**
* Class constructor
*
* @param string $name The asset name
* @param string $uri The URI for the asset
* @param array $options Additional options for the asset
* @param array $attributes Attributes for the asset
* @param array $dependencies Asset dependencies
*
* @since 4.0.0
*/
public function __construct(
string $name,
string $uri = null,
array $options = [],
array $attributes = [],
array $dependencies = []
) {
parent::__construct($name, $uri, $options, $attributes, $dependencies);
// Prepare Uri depend from the active language
$langTag = Factory::getApplication()->getLanguage()->getTag();
$client = $this->getOption('client');
// Create Uri <client>/language/<langTag>/<langTag>.css
if ($client) {
$this->uri = $client . '/language/' . $langTag . '/' . $langTag . '.css';
} else {
$this->uri = 'language/' . $langTag . '/' . $langTag . '.css';
}
}
}
The same content is in 5 releases, Joomla 4.2.0-beta3 to 4.2.1-rc2. See them all, or every version of this file.