ソースを参照

cookie into sov

master
Charly 3年前
コミット
d4627f788b
5個のファイルの変更16行の追加88行の削除
  1. +0
    -7
      config/packages/ch_cookie_consent.yaml
  2. +6
    -1
      config/packages/lc_sov.yaml
  3. +0
    -2
      config/routes/ch_cookie_consent.yaml
  4. +10
    -8
      config/services.yaml
  5. +0
    -70
      src/Form/CookieConsentTypeExtension.php

+ 0
- 7
config/packages/ch_cookie_consent.yaml ファイルの表示

@@ -1,7 +0,0 @@
ch_cookie_consent:
theme: 'light' # light, dark
categories: # Below are the default supported categories
- 'piwik'
use_logger: true # Logs user actions to database
position: 'bottom' # top, bottom
simplified: false # When set to true the user can only deny or accept all cookies at once

+ 6
- 1
config/packages/lc_sov.yaml ファイルの表示

@@ -1,3 +1,8 @@
# see https://symfony.com/doc/current/reference/configuration/framework.html
lc_sov:
homepage_route: 'app_homepage'
homepage_route: 'app_homepage'
login_redirection:
redirect_referer: false
roles_redirection:
- { role: "ROLE_ADMIN", redirect: "app_admin_dashboard" }
- { role: "ROLE_SUPER_ADMIN", redirect: "app_admin_dashboard" }

+ 0
- 2
config/routes/ch_cookie_consent.yaml ファイルの表示

@@ -1,2 +0,0 @@
ch_cookie_consent:
resource: "@CHCookieConsentBundle/Resources/config/routing.yaml"

+ 10
- 8
config/services.yaml ファイルの表示

@@ -35,11 +35,13 @@ services:

Mailjet\MailjetSwiftMailer\SwiftMailer\MailjetTransport: '@swiftmailer.mailer.transport.mailjet'

app.form.extension.type.cookie_consent:
class: App\Form\CookieConsentTypeExtension
tags:
- { name: form.type_extension, extended_type: ConnectHolland\CookieConsentBundle\Form\CookieConsentType }
arguments:
- '@ConnectHolland\CookieConsentBundle\Cookie\CookieChecker'
- '%ch_cookie_consent.categories%'
- '%ch_cookie_consent.simplified%'

#Pour remplacer le form cookie consent
# app.form.extension.type.cookie_consent:
# class: App\Form\CookieConsent
# tags:
# - { name: form.type_extension, extended_type: ConnectHolland\CookieConsentBundle\Form\CookieConsentType }
# arguments:
# - '@ConnectHolland\CookieConsentBundle\Cookie\CookieChecker'
# - '%ch_cookie_consent.categories%'
# - '%ch_cookie_consent.simplified%'

+ 0
- 70
src/Form/CookieConsentTypeExtension.php ファイルの表示

@@ -1,70 +0,0 @@
<?php

namespace App\Form;

use ConnectHolland\CookieConsentBundle\Cookie\CookieChecker;
use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
use ConnectHolland\CookieConsentBundle\Form\CookieConsentType as BaseCookieConsentType;

class CookieConsentTypeExtension extends AbstractTypeExtension
{
/**
* @var CookieChecker
*/
protected $cookieChecker;

/**
* @var array
*/
protected $cookieCategories;

/**
* @var bool
*/
protected $cookieConsentSimplified;

public function __construct(
CookieChecker $cookieChecker,
array $cookieCategories = [],
bool $cookieConsentSimplified = null
) {
$this->cookieChecker = $cookieChecker;
$this->cookieCategories = $cookieCategories;
$this->cookieConsentSimplified = $cookieConsentSimplified;
}

public function buildForm(FormBuilderInterface $builder, array $options)
{
foreach ($this->cookieCategories as $category) {
$builder->remove($category);

$data = 'true';
if ($this->cookieChecker->isCookieConsentSavedByUser() && !$this->cookieChecker->isCategoryAllowedByUser(
$category
)) {
$data = 'false';
}

$builder->add(
$category,
ChoiceType::class,
[
'expanded' => true,
'multiple' => false,
'data' => $data,
'choices' => [
['ch_cookie_consent.yes' => 'true'],
['ch_cookie_consent.no' => 'false'],
],
]
);
}
}

public static function getExtendedTypes(): iterable
{
return [BaseCookieConsentType::class];
}
}

読み込み中…
キャンセル
保存