1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <?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");
- }
- }
|