Example Drupal module for The Infinite Wonder of the Symfony Event Dispatcher talk at Drupalcon 2016.
See license file for licensing information
The following files are avialable:
-
src/BlackListService.php - A simple service that identifies all IP addresses that are not
127.0.0.1
as blacklisted. -
src/EventSubscriber.php - A service that subscribes to
kernel.request
events and utilizes the blacklist service to determine if a requesting IP should get an access denied response. It will only be denied if the request is not a Sub Request and is not requesting an admin URL. -
drupal_event_dispatcher_example.services.yml Services YAML file for the example that wires all of the services together and registers the event subscriber via the proper tag.
-
drupal_event_dispatcher_example.info.yml Module YAML file.
-
Install the plugin (Under Custom)
-
Navigate to the home page
-
Get an access denied