Pinesh Kumar โ made their first commit to this issueโs fork.
Duplicate of #3171835: https://www.drupal.org/project/drupal/issues/3171835 ๐ Field Groups marked as required are missing red asterisk Needs work
Pinesh Kumar โ created an issue.
In Drupal 8 and later, you can use an event subscriber to achieve similar functionality. Here's an example of how you can convert your code to work in Drupal 8/9/10:
1. Create a file for your custom module:
Create a file named MYMODULE.services.yml in your module's src directory (create the src directory if it doesn't exist yet).
2. Define the service:
Add the following code to MYMODULE.services.yml to define the service and the class that will handle the event:
services:
MYMODULE.event_subscriber:
class: '\Drupal\MYMODULE\EventSubscriber\RedirectEventSubscriber'
tags:
- { name: 'event_subscriber' }
3. Create the event subscriber class:
Create a file named RedirectEventSubscriber.php in your module's src/EventSubscriber directory (create the EventSubscriber directory if it doesn't exist yet). Add the following code to the file:
<?php
namespace Drupal\MYMODULE\EventSubscriber;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents;
class RedirectEventSubscriber implements EventSubscriberInterface {
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
$events[KernelEvents::REQUEST][] = ['onRequest'];
return $events;
}
/**
* Redirect logic.
*/
public function onRequest(GetResponseEvent $event) {
$request = $event->getRequest();
$path = \Drupal::service('path.current')->getPath();
$arg = explode('/', trim($path, '/'));
$last_key = key(array_slice($arg, -1, 1, TRUE));
if ($arg[$last_key] == 'all') {
unset($arg[$last_key]);
$redirect_path = implode('/', $arg);
$response = new \Symfony\Component\HttpFoundation\RedirectResponse($redirect_path, 301);
$event->setResponse($response);
}
}
}
Now, the logic from your MYMODULE_init() function has been moved to the RedirectEventSubscriber class. This class listens for the KernelEvents::REQUEST event and checks for the 'all' path component, redirecting as needed.
Issue #123456: Updated DashboardForm to be compatible with Drupal 9/10 coding standards
This patch updates the DashboardForm class in the Mail Safety module to adhere to the coding standards of Drupal 9/10. The changes include:
- Updated reset btn id(#edit-keyword-search) for keyword search.
- Updated class dependencies to use the correct type-hinted interfaces.
- Updated translation function calls to use $this->t() for proper translation handling.
- Updated class and method comments to provide more meaningful descriptions.
Drupal Upgrade Status and coding standards.
Automated Drupal 10 compatibility fixes
vuil
I have updated the permission. Please check.
thank you!!