New updates.

This commit is contained in:
Dan Chadwick
2024-08-24 18:33:34 -04:00
parent 2b5c281846
commit f63bdddde4
26 changed files with 14233 additions and 595 deletions

View File

@@ -1,10 +1,10 @@
.swiper {
width: 600px;
height: 300px;
width: 100%;
height: auto;
}
.ping-pong-wrapper {
max-height: 600px;
/* max-height: 600px; */
display: flex;
width: 100%;
}
@@ -44,11 +44,13 @@
.ping-pong > div {
flex: 1;
max-width: 50%;
}
@media screen and (max-width: 767px) {
.ping-pong > div {
flex: 1 0 100%;
max-width: 100%;
}
}

View File

@@ -0,0 +1,5 @@
name: Nodepath Access
description: 'Prevent users from accessing /node/* paths'
core_version_requirement: ^10 | ^11
type: module
package: Custom

View File

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

View File

@@ -0,0 +1,4 @@
access nodepath route:
title: 'Allow access to nodepaths'
description: 'Allows access to /node/ paths'

View File

@@ -0,0 +1,5 @@
services:
nodepath_access_kernel_subscriber:
class: '\Drupal\nodepath_access\EventSubscriber\KernelRequestNodePathCheck'
tags:
- { name: 'event_subscriber' }

View File

@@ -0,0 +1,44 @@
<?php
namespace Drupal\nodepath_access\EventSubscriber;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* Class EntityTypeSubscriber.
*
* @package Drupal\nodepath_access\EventSubscriber
*/
class KernelRequestNodePathCheck implements EventSubscriberInterface {
/**
* {@inheritdoc}
*
* @return array
* The event names to listen for, and the methods that should be executed.
*/
public static function getSubscribedEvents() {
return [
KernelEvents::REQUEST => 'onRequest',
];
}
/**
* React to a config object being saved.
*/
public function onRequest(RequestEvent $event) {
$user = \Drupal::currentUser();
$user_roles = $user->getRoles();
if (!in_array('anonymous', $user_roles)) {
return;
}
$current_request = \Drupal::requestStack()->getCurrentRequest();
$path = \Drupal::request()->getRequestUri();
if (str_contains($path, '/node/')) {
throw new NotFoundHttpException();
}
}
}