Commit 36aa02f1 authored by Sven Berg Ryen's avatar Sven Berg Ryen
Browse files

Issue #2985390 by Anybody, svenryen, jo.st, flefle, MrPaulDriver, tijsdeboeck,...

Issue #2985390 by Anybody, svenryen, jo.st, flefle, MrPaulDriver, tijsdeboeck, leymannx, upunkt, bramvandenbulcke, gabrimonfa, Grayle, portulaca, anderz, RobbM: [1.x] Option to place Withdraw Button anywhere on site (e.g. in block)
parent 11876449
Loading
Loading
Loading
Loading
+10 −0
Changes for eu_cookie_compliance.links.menu.yml: 10 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -26,3 +26,13 @@ entity.cookie_category.collection:
  description: 'Administer cookie categories.'
  parent: eu_cookie_compliance
  weight: 99
eu_cookie_compliance.toggle_cookie_settings_withdraw:
  title: "Cookie settings"
  description: "Toggle the cookie consent settings tray"
  url: "internal:#sliding-popup"
  menu_name: tools
  options:
    attributes:
      onclick: "if (Drupal.eu_cookie_compliance) { Drupal.eu_cookie_compliance.toggleWithdrawBanner(); } return false;"
      class:
        - eu-cookie-compliance-toggle-withdraw-banner
+10 −2
Changes for src/Plugin/Block/CookieSettingsButtonBlock.php: 10 added lines, 2 removed lines.
Original line number Diff line number Diff line
<?php

namespace Drupal\eu_cookie_compliance\Plugin\Block;

use Drupal\Core\Url;
use Drupal\Core\Block\BlockBase;
use Drupal\Core\Block\BlockPluginInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Access\AccessResult;

/**
 * Provides a 'CookieSettingsButtonBlock' block.
 * Provides a "CookieSettingsButtonBlock" block.
 *
 * @Block(
 *   id = "eu_cookie_compliance_button_block",
 *   admin_label = @Translation("EU Cookie Compliance Button Block")
 * )
 */
class CookieSettingsButtonBlock extends BlockBase {

@@ -39,6 +45,7 @@ class CookieSettingsButtonBlock extends BlockBase {
        ],
      ];
    }
    else {
      return [
        '#title' => $this->t('Cookie settings'),
        '#markup' => $this->t('This block requires the "@withdraw_enabled_setting_name" to be enabled in <a href="@eu_cookie_compliance_settings_url">EU Cookie Compliance settings</a>.',
@@ -49,5 +56,6 @@ class CookieSettingsButtonBlock extends BlockBase {
        ),
      ];
    }
  }

}