Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: chamilo/chamilo-lms
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: ca7d37c1f809114180d5d79589e69eb1c8133401
Choose a base ref
..
head repository: chamilo/chamilo-lms
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 4cffd268fd9dbaa85ab5f44320c1667fecaf97a1
Choose a head ref
12 changes: 5 additions & 7 deletions public/main/inc/lib/display.lib.php
Original file line number Diff line number Diff line change
@@ -9,8 +9,7 @@
use Chamilo\CoreBundle\Entity\ExtraField;
use Chamilo\CoreBundle\Entity\ExtraFieldValues;
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CoreBundle\Repository\ColorThemeRepository;
use Chamilo\CoreBundle\ServiceHelper\AccessUrlHelper;
use Chamilo\CoreBundle\ServiceHelper\ThemeHelper;
use ChamiloSession as Session;
use Symfony\Component\HttpFoundation\Response;

@@ -2673,13 +2672,12 @@ public static function getFrameReadyBlock(
return false;
}

$accessUrlHelper = Container::$container->get(AccessUrlHelper::class);
$router = Container::getRouter();
$themeHelper = Container::$container->get(ThemeHelper::class);

$urlRelColorTheme = $accessUrlHelper->getCurrent()->getActiveColorTheme();
$themeColorsUrl = $themeHelper->getThemeAssetUrl('colors.css');

$colorThemeItem = $urlRelColorTheme
? '{ type: "stylesheet", src: "'.$router->generate('chamilo_color_theme').'" },'
$colorThemeItem = $themeColorsUrl
? '{ type: "stylesheet", src: "'.$themeColorsUrl.'" },'
: '';

return '$.frameReady(function() {},
47 changes: 0 additions & 47 deletions src/CoreBundle/Controller/ThemeController.php

This file was deleted.

18 changes: 12 additions & 6 deletions src/CoreBundle/Migrations/Schema/V200/Version20231110194300.php
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@

use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Finder\Finder;

final class Version20231110194300 extends AbstractMigrationChamilo
@@ -17,12 +18,9 @@ public function getDescription(): string
return 'Copy custom theme folder to assets and update webpack.config';
}

public function up(Schema $schema): void
private function getDefaultThemeNames(): array
{
$kernel = $this->container->get('kernel');
$rootPath = $kernel->getProjectDir();

$customThemesFolders = [
return [
'academica',
'chamilo',
'chamilo_red',
@@ -52,6 +50,14 @@ public function up(Schema $schema): void
'simplex',
'tasty_olive',
];
}

public function up(Schema $schema): void
{
$kernel = $this->container->get('kernel');
$rootPath = $kernel->getProjectDir();

$defaulThemesFolders = $this->getDefaultThemeNames();

$sourceDir = $rootPath.'/app/Resources/public/css/themes';
$destinationDir = $rootPath.'/assets/css/themes/';
@@ -67,7 +73,7 @@ public function up(Schema $schema): void
foreach ($finder as $folder) {
$folderName = $folder->getRelativePathname();

if (!\in_array($folderName, $customThemesFolders, true)) {
if (!\in_array($folderName, $defaulThemesFolders, true)) {
$sourcePath = $folder->getRealPath();
$destinationPath = $destinationDir.$folderName;

2 changes: 1 addition & 1 deletion src/CoreBundle/ServiceHelper/ThemeHelper.php
Original file line number Diff line number Diff line change
@@ -87,7 +87,7 @@ public function getThemeAssetUrl(string $path, bool $absolute = false): string
return $this->assetExtension->getAssetUrl($base."build/css/themes/$themeName/$path");
}

public function getThemAssetLinkTag(string $path, bool $absoluteUrl = false): string
public function getThemeAssetLinkTag(string $path, bool $absoluteUrl = false): string
{
$url = $this->getThemeAssetUrl($path, $absoluteUrl);

6 changes: 3 additions & 3 deletions src/CoreBundle/Twig/Extension/ChamiloExtension.php
Original file line number Diff line number Diff line change
@@ -73,7 +73,7 @@ public function getFunctions(): array
new TwigFunction('chamilo_settings_has', [$this, 'hasSettingsParameter']),
new TwigFunction('password_checker_js', [$this, 'getPasswordCheckerJs'], ['is_safe' => ['html']]),
new TwigFunction('theme_asset', $this->getThemeAssetUrl(...)),
new TwigFunction('theme_asset_link_tag', $this->getThemAssetLinkTag(...), ['is_safe' => ['html']]),
new TwigFunction('theme_asset_link_tag', $this->getThemeAssetLinkTag(...), ['is_safe' => ['html']]),
];
}

@@ -233,8 +233,8 @@ public function getThemeAssetUrl(string $path, bool $absolute = false): string
return $this->themeHelper->getThemeAssetUrl($path, $absolute);
}

public function getThemAssetLinkTag(string $path, bool $absoluteUrl = false): string
public function getThemeAssetLinkTag(string $path, bool $absoluteUrl = false): string
{
return $this->themeHelper->getThemAssetLinkTag($path, $absoluteUrl);
return $this->themeHelper->getThemeAssetLinkTag($path, $absoluteUrl);
}
}