Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
"php": "^7.4 || ^8.0",
"gedmo/doctrine-extensions": "^3",
"friendsofsymfony/jsrouting-bundle": "^2",
"tijsverkoyen/css-to-inline-styles": "^2.2",
"knplabs/knp-menu-bundle": "^3.0",
"sensio/framework-extra-bundle": "^6.1",
"symfony/form": "^5.3",
"symfony/asset": "^5.3",
"symfony/console": "^5.3",
"symfony/security-bundle": "^5.3",
"symfony/translation": "^5.3",
Expand Down
14 changes: 0 additions & 14 deletions config/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
use SumoCoders\FrameworkCoreBundle\Twig\PaginatorRuntime;
use SumoCoders\FrameworkCoreBundle\Twig\PaginatorExtension;
use SumoCoders\FrameworkCoreBundle\Twig\FrameworkExtension;
use SumoCoders\FrameworkCoreBundle\Service\Theme;
use SumoCoders\FrameworkCoreBundle\Service\JsData;
use SumoCoders\FrameworkCoreBundle\Service\BreadcrumbTrail;
use SumoCoders\FrameworkCoreBundle\EventListener\BreadcrumbListener;
use SumoCoders\FrameworkCoreBundle\Menu\MenuBuilder;
Expand Down Expand Up @@ -43,18 +41,6 @@
param('fallbacks')
])

->set('framework.jsdata', JsData::class)
->args([
service('request_stack')
])

->set('framework.theme', Theme::class)
->args([
service('request_stack'),
service('framework.jsdata'),
service('assets.packages')
])

/*
* Menu
*/
Expand Down
38 changes: 0 additions & 38 deletions src/Service/JsData.php

This file was deleted.

52 changes: 0 additions & 52 deletions src/Service/Theme.php

This file was deleted.

29 changes: 29 additions & 0 deletions src/Twig/FrameworkExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,44 @@

namespace SumoCoders\FrameworkCoreBundle\Twig;

use Symfony\Component\HttpFoundation\RequestStack;
use Twig\Extension\AbstractExtension;
use Twig\TwigFilter;
use Twig\TwigFunction;

class FrameworkExtension extends AbstractExtension
{
private RequestStack $requestStack;

public function __construct(RequestStack $requestStack)
{
$this->requestStack = $requestStack;
}

public function getFilters(): array
{
return [
new TwigFilter('ucfirst','ucfirst'),
];
}

public function getFunctions(): array
{
return [
new TwigFunction('theme', [$this, 'determineTheme']),
];
}

public function determineTheme(): string
{
if (is_null($this->requestStack->getCurrentRequest())) {
return 'theme-light';
}

if (!$this->requestStack->getCurrentRequest()->cookies->has('theme')) {
return 'theme-light';
}

return 'theme-' . $this->requestStack->getCurrentRequest()->cookies->get('theme');
}
}
7 changes: 1 addition & 6 deletions templates/base.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{ include('@SumoCodersFrameworkCore/head.html.twig') }}
{% endblock %}

<body class="body-base">
<body class="body-base" data-theme-path="{{ asset('build/style-dark') }}">
<div id="main-wrapper" class="main-wrapper" data-sidebar-wrapper>
<div id="main-menu" class="main-menu" role="navigation">
{% block include_navigation %}
Expand Down Expand Up @@ -41,11 +41,6 @@
{% endif %}
</div>

<div class="loading-indicator d-none" data-role="ajax-indicator">
<p class="text-center">{{ 'core.interface.loading'|trans|ucfirst }}...</p>
<div class="loading-bar"></div>
</div>

<section id="main" role="main">
<div class="header-subbar">
{{ include('@SumoCodersFrameworkCore/notifications.html.twig') }}
Expand Down
8 changes: 1 addition & 7 deletions templates/head.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,7 @@
{{ encore_entry_link_tags('style-dark') }}
{% endif %}
{% endblock %}

{% block head_javascripts %}
<script type="text/javascript" nonce="FOR725">
const jsData = {{ jsData|raw }};
</script>
{% endblock %}


{% block icons %}
<link rel="apple-touch-icon" href="{{ asset('build/images/apple-touch-icon.png') }}">
<link rel="image_src" href="{{ asset('build/images/image_src.png') }}" />
Expand Down