- md5
- 5d76038b8f901d4419826c30fe490a8b
- sha1
- 7fb4d228a515d4e82de5bbb5cdde277e26c4442d
- sha256
- 652e10c6ab8e8788f8161379faec90647ee1fe10f44dbee7c26f6476a5eed9b8
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
<?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;
// phpcs:disable PSR1.Files.SideEffects
\defined('JPATH_PLATFORM') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* 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 70 releases, Joomla 4.2.1 to 4.4.14. See them all, or every version of this file.