started rgpd integration
This commit is contained in:
@@ -21,3 +21,11 @@ materio_user.login_block:
|
||||
_format: json
|
||||
requirements:
|
||||
_access: 'TRUE'
|
||||
|
||||
materio_user.privacy_policy:
|
||||
path: '/privacy-policy'
|
||||
defaults:
|
||||
_controller: '\Drupal\materio_user\Controller\MaterioUserPrivacyPolicy::getPp'
|
||||
_title_callback: '\Drupal\materio_user\Controller\MaterioUserPrivacyPolicy::getTitle'
|
||||
requirements:
|
||||
_permission: 'access content'
|
||||
|
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\materio_commerce\Controller;
|
||||
|
||||
use Drupal\Core\Controller\ControllerBase;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Drupal\Core\Language\LanguageManagerInterface;
|
||||
use Drupal\Core\Url;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
// use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Drupal\config_pages\Entity\ConfigPages;
|
||||
use Drupal\config_pages\Entity\ConfigPagesType;
|
||||
|
||||
/**
|
||||
* Class AjaxHomeController.
|
||||
*/
|
||||
class MaterioCommerceTermsViewer extends ControllerBase {
|
||||
|
||||
|
||||
/*
|
||||
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
|
||||
*/
|
||||
protected $languageManager;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function create(ContainerInterface $container) {
|
||||
return new static(
|
||||
$container->get('language_manager')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new MaterioDecoupledLanguageLinks object.
|
||||
*
|
||||
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
|
||||
* The language manager.
|
||||
*/
|
||||
public function __construct(LanguageManagerInterface $language_manager) {
|
||||
$this->languageManager = $language_manager;
|
||||
}
|
||||
|
||||
/**
|
||||
* getTerms
|
||||
*
|
||||
* @return string
|
||||
* Return config_page terms_of_services display.
|
||||
*/
|
||||
public function getTos(Request $request) {
|
||||
$config_page = $this->getConfigPage();
|
||||
|
||||
// Correct metatags attachment.
|
||||
if (function_exists('metatag_get_tags_from_route')) {
|
||||
$metatag_attachments = &drupal_static('metatag_attachments');
|
||||
$metatag_attachments = metatag_get_tags_from_route($config_page);
|
||||
}
|
||||
|
||||
return parent::entityTypeManager()->getViewBuilder('config_pages')->view($config_page, 'full');
|
||||
|
||||
}
|
||||
|
||||
public function getTitle(Request $request) {
|
||||
$config_page = $this->getConfigPage();
|
||||
return $config_page->get('field_title')->getString();
|
||||
}
|
||||
|
||||
private function getConfigPage(){
|
||||
return ConfigPages::load("terms_of_services");
|
||||
}
|
||||
}
|
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\materio_user\Controller;
|
||||
|
||||
use Drupal\Core\Controller\ControllerBase;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Drupal\Core\Language\LanguageManagerInterface;
|
||||
use Drupal\Core\Url;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
// use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Drupal\config_pages\Entity\ConfigPages;
|
||||
use Drupal\config_pages\Entity\ConfigPagesType;
|
||||
|
||||
/**
|
||||
* Class AjaxHomeController.
|
||||
*/
|
||||
class MaterioUserPrivacyPolicy extends ControllerBase {
|
||||
|
||||
|
||||
/*
|
||||
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
|
||||
*/
|
||||
protected $languageManager;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function create(ContainerInterface $container) {
|
||||
return new static(
|
||||
$container->get('language_manager')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new MaterioDecoupledLanguageLinks object.
|
||||
*
|
||||
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
|
||||
* The language manager.
|
||||
*/
|
||||
public function __construct(LanguageManagerInterface $language_manager) {
|
||||
$this->languageManager = $language_manager;
|
||||
}
|
||||
|
||||
/**
|
||||
* getTerms
|
||||
*
|
||||
* @return string
|
||||
* Return config_page terms_of_services display.
|
||||
*/
|
||||
public function getPp(Request $request) {
|
||||
$config_page = $this->getConfigPage();
|
||||
|
||||
// Correct metatags attachment.
|
||||
if (function_exists('metatag_get_tags_from_route')) {
|
||||
$metatag_attachments = &drupal_static('metatag_attachments');
|
||||
$metatag_attachments = metatag_get_tags_from_route($config_page);
|
||||
}
|
||||
|
||||
return parent::entityTypeManager()->getViewBuilder('config_pages')->view($config_page, 'full');
|
||||
|
||||
}
|
||||
|
||||
public function getTitle(Request $request) {
|
||||
$config_page = $this->getConfigPage();
|
||||
return $config_page->get('field_title')->getString();
|
||||
}
|
||||
|
||||
private function getConfigPage(){
|
||||
return ConfigPages::load("privacy_policy");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user