Extra Block Types (EBT) - New Layout Builder experience❗
Extra Block Types (EBT) - styled, customizable block types: Slideshows, Tabs, Cards, Accordions and many others. Built-in settings for background, DOM Box, javascript plugins. Experience the future of layout building today.
❗Extra Paragraph Types (EPT) - New Paragraphs experience
Extra Paragraph Types (EPT) - analogical paragraph based set of modules.
            Scroll
          
        Drupal Database query
        22/02/2025, by Anonymous (not verified)
        
      
  
  Forums
              
          
You would use the database abstraction layer.
As for executing the query, you can also fetch results in various ways.
Examples:
If you are within a class, you should inject the appropriate classes in your constructor instead of use the static Drupal container. But since you are in a preprocess function,
\Drupal::database()is fine.From
core/lib/Drupal.php:Depending on your use case(s), you can also leverage EntityQuery:
Please note that you may want to use
node_field_datatable instead ofnode, but your query is pretty generic so it is hard to tell without a better query.Example, get all nodes of type that are published:
Or:
Drupal 8 Documentation:
https://www.drupal.org/docs/8/api/database-api