- md5
- fad733e5cafc2ecee0e8bd062717cc74
- sha1
- 871c97b6e94adeae58f453851c364b6816daab95
- sha256
- bc8ceb7fc8f4faabcc46a512d54216193dd88d64c4e2b4e8a7465a18b1ff1a88
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
<?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;
\defined('JPATH_PLATFORM') or die;
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 51 releases, Joomla 4.0.0-beta6 to 4.2.0-beta2. See them all, or every version of this file.