- md5
- 93a040a0750c741a372d00518e37784e
- sha1
- 8c6e034650c796abf6067538ac5fb3caaf49ae45
- sha256
- 6a0d226c112603ef9a9a373c8ac9d9dd5bd187c92076d88e72ce5cd610a72672
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
<?php
/**
* Joomla! Content Management System
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
* @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 5 releases, Joomla 4.0.0-beta to 4.0.0-beta5. See them all, or every version of this file.