PHP 8.1 introduced a new data model, Enumerations. Enumerations allow for the creation of custom data models that can only contain a fixed set of allowed values. These enumerations can be very useful when working with Drupal list fields, which are a field type that allows for selection from a predefined set of values. As both enumerations and list field contain a predefined set of values, using Enumerations to back Drupal list field makes for more stable code that is easier to understand, and less likely to fail.
I'm developing a Drupal 10 website with the DXPR Builder default theme and have two views that combine Flex Slider with the content events module to display events. My goal is to:
1. Display the first slider for both anonymous users and logged-in users.
2. Display the second slider only for logged-in users who have specific roles (e.g., admin, manager, content creator).
I've attempted to achieve this using Contextual Filters, but I haven't been able to get it to work as expected.
This thread may wander a lot, but the original reason for creating this thread today is that I have a .js file with mostly jQuery instructions within it. This script is supposed to help me re-order a select list on a [Better-Exposed-Filters] form; and, believe it or not, it works! Except on ONE of my many Drupal 10.3 websites.
We had to turn on MySQL's general log to satisfy a security requirement. Recently our site was attacked with a zillion bogus requests. 99.99% of these resulted in 404s it caused our disk space to fill up because the general log was recording every query caused by these bogus requests. Why does Drupal do this?
Is there any way to stop this from happening?
I attempted to implement a "class WhitelistRoutesSubscriber implements EventSubscriberInterface {...}" and redirect the bogus requests with a 403 but that didn't stop Drupal from querying the database.
I'm trying to code a block plugin that will send variable values to the template based on the current URL. I have the block working and displaying for the most part but I'm having trouble getting the path I need to compare to. I've tried looking through the docs and googling but so much of the info is outdated for a Drupal 10 project. My problem is I don't seem to be able to get the services I want via dependency injection in a block and the services I managed to use don't actually give me the path alias that I'm looking for. I'm currently accessing the path info like so: