/r/drupal

Photograph via snooOG

The place for news, articles, and discussion regarding Drupal and Backdrop, one of the top open source (GPL) CMS platforms powering millions of websites and applications, built, used, and supported by a diverse community of people worldwide.

More Info: http://drupal.org and https://backdropcms.org

Check out the sidebar for our AMA schedule, or view our past AMA's.


Welcome to r/Drupal

The place for news, articles and discussion regarding one of the top open source (GPL) CMS platforms: Drupal.

More Info: Drupal.org


Previous AMA's:

Latest AMA:

  • Mike Gifford (Accessibility Core Maintainer Drupal 8) – Click Here

Upcoming AMA's:

  • When would you like to start? Let us know!

Would you or someone you know make for an interesting Drupal AMA? Message the mods.


Weekly rotating posts

  • Monday: Beginner questions - no question is too easy.
  • Tuesday: Triumphant Tuesday - post recent Drupal successes and site launches
  • Wednesday: Contrib modules chat - Talk about recently tried modules, recommendations, warnings, etc.
  • Thursday: Development questions & discussion - Coding questions go here. Anything dev-related goes.
  • Friday: Useful things to know - Things you wish you had known earlier about Drupal.

Drupal Resources


Rules & Requests

Please no job ads. If you wish to post something of that nature we suggest you check out Drupal.org's paid services job board


Our Friends

/r/drupal

16,635 Subscribers

2

New to Drupal, Rant

hey all

I started Drupal last week (yes I know, too soon) although i have used wordpress and Odoo for websites, I find myself frustrated by hitting a wall whatever I do.

The project is a simple site with a cover image, apartment listings, search, and map to show the listings with geolocation.

  1. I tried to find free themes but they all seem to be for drupal 8 or 9

  2. I dont know enough yet in order to purchase a paid theme and customize it (for example a paid site may have listings but not map in the demo)

One issue I am facing is that most of the info im finding doesnt correspond to current way of doing things.

For example: in order to make a cover image, I read I need to create a custom block in block layout.

No such option exists. After some time I found that I now need to create a new content block instead of a custom block library. So when I click on that I get an http server error 500. I then installed drupal 10 and also tried 11 with xampp in order to be able to change things on my part (for example memory limit):

  1. Drupal 10. New content block - memory limit error - change memory limit to 8192M, same - so not a memory limit error. (it has sth like \xampp\htdocs\drupal1037\vendor\twig\twig\src\Extension\SandboxExtension.php on line 130)

The thing is that this is a default installation of drupal 10 and using olivero as a base theme, why is there such an error on a default installation for a common content creation?

  1. Drupal 11. cant install, problem with php version. attempt to upgrade php to 8.3.13 on xampp. have to enable gd. enabled gd in php.ini (after renaming php development to php.ini). drupal still says cant install because gd not enabled..

Also, drupal 11 only uses composer for modules and themes, so I have to look into that, although at some point i did install with docker desktop and tried to make the website using composer and drush.

I eventually loaded so many modules to do simple things that I think it broke the database and i had to start from scratch.

Even using geolocation field and common map, i couldnt make the hover info and clusters work, another headache waiting.

Have I chosen a wrong path here? Is there an easier way to do this website ?

Thank you for reading my story

3 Comments
2024/11/09
12:28 UTC

2

If I am creating a page using Paragraphs to build each section, how do I override each Paragraph Twig template if all of them have the same file name suggestion?

I took the advice to build the pages using Paragraphs instead of Blocks. What I have done is add a Paragraph field to a Basic page and set it to unlimited. I created a Paragraph type called Page section with a title and media fields. I then added a couple of Paragraphs to one of the pages each containing the title and necessary images for the design.

Now, I want to be able to override each of the Paragraph Twig templates to put in custom markup and styles. But the problem is that all of the Paragraphs have the same file name suggestion of paragraph--page-section--default.html.twig so I cannot override them individually.

The obvious solution seems to be creating a separate Paragraph type for each section of the page. Should I just create Paragraph types named First section, Second section, and so on even though they will all be identical? I'm not sure if this is any more manageable than using Blocks in the long run. Or should I opt for something like Layout paragraphs?

28 Comments
2024/11/08
13:38 UTC

2

How would I make a custom teaser template for a content type that is NOT already using a custom twig template?

Can I make a custom teaser template for a content type that is not using a custom twig template (in Drupal 10)?

If I'm reading the docs correctly, it looks like I would simply make a file in the templates directory and name it:

node--my_content_type--teaser.html.twig

And the contents of that file could look something like:

{% if view_mode == 'teaser' %}

    <div>
        {{ content.field_name_one }}
    </div>

    <div>
        {{ content.field_name_two }}
    </div>

{% endif %}

Is it as easy as that? Do I even need the if / endif?

Having this teaser template wouldn't affect the default template, right?

(As you can no doubt tell, I'm just getting myself up to speed on some of the basics! Thanks in advance!)

17 Comments
2024/11/07
22:42 UTC

5

Memcached for caching instead of MySQL

Hi, I'm a sysadmin working for a company heavily using Drupal.

Monitoring our servers I noticed an heavy I/O work by our biggest Drupal sites, mostly due to MySQL queries on cache tables, this results in a lot of I/O wait CPU load and not very exciting performances.

Usually our configuration is made with

  • nginx webserver
  • php and php-fpm 8.1 or 8.3
  • on some instances solr 9.x as a search engine

Now we're evaluating Memcached to improve performance, mostly for reduce the cache workload on MySQL and move it to Memcached.

Do you think it's a good idea?

From your experience Memcached is effective in this kind of workloads?

Do you have any suggestions on Memcached configuration?

Thanks

15 Comments
2024/11/07
22:01 UTC

1

Gutenberg editor on commerce_product edit screen

Hi All

At my clients, we have a gutenberg implementation on their drupal 10 system.
We've built plenty of blocks they can use on several node_types to build up the content pages they want.

Currently we are implementing a 2-tiered event system.
First part is "free events", defined as a content node, with a registration form. Here we enabled the gutenberg experience, and they can configure their event, as well as build the content page up using the gutenberg editor.

The 2nd part is "Paid events", here we are re-using the commerce_product implementation. Products are modelled in SAP, synced through a PIM system, and identified as products in the drupal system.
We now want to allow the content admins to create the product pages for these events, using the gutenberg editor.

This is what I am unable to accomplish and need guidance.
So far I have a body textarea, which accepts the gutenberg configuration, that is then correctly rendered as the product page.
However, the textarea is plaintext, and does not load the gutenberg editor.
If I remove the gutenberg limitations of the text field, it renders a CKEDITOR, with the gutenberg blocks correctly rendered, but you can't configure them this way...

How can I get the gutenberg editor to load up for this edit screen?

Google didn't help, ChatGPT didn't help...

Please reddit, be my savior :)

0 Comments
2024/11/07
14:40 UTC

1

How to add Drupal 11 support to a module with branches supporting Drupal 8 and 9?

Due to some circumstances, I’ve temporarily taken on the responsibility of supporting our company’s Drupal plugin. However, I have no prior experience with PHP development, nor am I familiar with the Drupal ecosystem. Unfortunately, I’m the one tasked with adding Drupal 11 support for our plugin.

GIVEN

  1. The module has two release branches (7.x-1.x and 8.x-1.x).
  2. Based on the tags, new features have only been added to the 8.x-1.x branch. So, while version 7 is still supported, it doesn’t receive new updates.
  3. Currently, the *info.yml in the 8.x-1.x branch contains core: 8.x and core_version_requirement: ^8 || ^9 || ^10, which suggests that the plugin supports versions 8, 9, and 10.
  4. To add support for version 11, I need to add accessCheck(FALSE) in several places (ref: Access checking must be explicitly specified).
  5. However, this function is only available starting from Drupal version 9.2.

QUESTIONS

  1. Am I correct in assuming that I need to update *info.yml to core: ^9.2 and core_version_requirement: ^9.2 || ^10 || ^11? If so, what should I do about clients still using Drupal 8?
  2. What is the recommended practice in the Drupal community: should I create a new release branch when updating core_version_requirement to ^9.2?

Thanks in advance for any guidance!

5 Comments
2024/11/07
12:05 UTC

1

Gutemberg and views

Hi, I need to create a custom page (Drupal v10 is the basis of the project) with some text and views. I wanted to use Gutemberg, but I haven't found anywhere if Gutemberg supports views or if it's possible to use tokens inside the texts (I create a token where I pass the view to insert). Otherwise I'll have to create a page using Paragraphs and here you are and I wonder: how heavy is Gutemberg on a production site?

1 Comment
2024/11/07
10:05 UTC

1

Migrate Contents from D7 to D10

Hi guys.

Actually, I'm not an expert with Drupal CMS. I have this client whose live website is Drupal 7, and he hired someone to upgrade it to Drupal 10, but later on he suspended the contract with the past developer, and now I am handling it.

So I have the drupal 10 project file on my local machine, and I think the past developer created it from fresh d10 and just copied or replicate the theme, views, taxonomy, etc. and some of its content. (this is just a hunch as I don't have any idea on what process that he did).

I do have an access to the server of the D7 and its project folder.

Now, everything is now ok, but D7 has alot of new contents that needed to be added in my D10 local project.

I am trying to use the Migrate Drupal UI, however, I can't see "configure" button in this module, and when I visit the upgrade page, it says that I am not authorize to access that page even though I am using an administrator.

Is there any way to fix this? or other solution to migrate the contents?

Cause the last resort that I have right now is to manually add the new content from d7 to my d10 local project which is very time-consuming and costly.

Hope you can help me guys hehe.

11 Comments
2024/11/07
08:23 UTC

4

Drupal Compatibility

We currently have a Drupal 9 website, and I don’t have much experience on the development side. However, I decided to integrate the Real-Time / Yoast SEO plugin so my Content Marketing colleague can use Yoast.js features when working on our webpages.

Our development agency informed me that this module isn’t compatible with Drupal 9, however our SEO agency says it does. I'm unsure who is correct?

The module page (https://www.drupal.org/project/yoast\_seo) states:

8.x-1.8 released 16 December 2022

Works with Drupal: 8 || 9 || 10

✓ Recommended by the project’s maintainer

Drupal 10 compatibility

Doesn’t the "9" here indicate compatibility with Drupal 9, especially as it also works with Drupal 10?

Thanks!

5 Comments
2024/11/06
14:32 UTC

6

Looking for advice on D7 to D10 transition

Over the past couple of years our company has been working on our migration from Drupal 7 to 10, which has also involved strategically trying to reduce our reliance on Drupal by decoupling the front-end via NextJS.

We're currently running a multisite setup which is a collection of related microsites which consist mostly of educational tools and interactive trainings. The frontends are a combination of either Drupal rendered sites, Angular, React and Next.

Under D10, our plan is to go entirely headless with Drupal with a single site setup, using it just for auth, maintenance of user profiles, storing user training progress, and probably some email functionality + webforms. (all via API) Because of the limited functionality, I'm thinking that setup of the new D10 site should be fairly straightforward and the complexity is probably more in migration of the data. We have about 50k registered users. At minimum we need to migrate existing user profiles. We'd like to migrate the users' stored training progress as well, but it may be kind of messy since I believe it's written directly do the database via custom modules.

Our company recently lost our only Drupal dev, so we're exploring different options for getting us through the finish line. Being that I'm not a Drupal dev, I could use advice on estimation of level of effort to get up to speed internally to implement what we need (my CMS experience is mostly Wordpress), or ballpark costs I would be looking at to partner with a Drupal shop to help us setup the site, document, and train my team.

Also any Drupal training resources -- specifically relating to a headless implementation-- would be very much appreciated!

10 Comments
2024/11/06
13:20 UTC

1

AJAX error when trying to edit Better Exposed Filter settings on a table view

In my D10 site, I'm attempting to put an exposed form on my table View via the Better Exposed Filters module. I can enable BEF, but when I click its settings link, I get an error message on the page:

Oops, something went wrong. Check your browser's developer console for more details.

And this in the console:

Uncaught 
Object { message: "\nAn AJAX HTTP error occurred.\nHTTP Result Code: 200\nDebugging information follows.\nPath: /admin/structure/views/ajax/display/site_content/page_1/exposed_form_options\nStatusText: parsererror\nResponseText: Fatal error: Declaration of Drupal\\select2\\Plugin\\better_exposed_filters\\filter\\Select2::defaultConfiguration() must be compatible with Drupal\\better_exposed_filters\\Plugin\\better_exposed_filters\\filter\\FilterWidgetBase::defaultConfiguration(): array in /code/web/modules/contrib/select2/src/Plugin/better_exposed_filters/filter/Select2.php on line 21"

The error is referencing Select2 which is installed an enabled. Both BEF and Select2 are up to date.

Any idea what is going on here?

6 Comments
2024/11/05
21:11 UTC

2

How do I get the field values in my Twig template when overriding a Views block?

I need to provide custom styles to one of my Views blocks which lists recent posts. As per the theme's suggestion, I created a file named block--views-block--latest-posts-block-1.html.twig to override the default implementation of views-view.html.twig. With the overridden file, the page works fine with just the {{ content }} statement. However, I am unable to properly access the dynamic data to insert into my custom markup.

With {{ dump(content) }}, I was able to locate the fields after looking around for a bit. They were nested inside several variables. So far, I have this

{{ content['#view'].field.created.original_value|render }}

This also prints out the Twig comments and HTML tags:

<!-- THEME DEBUG --> <!-- THEME HOOK: 'time' --> <!-- 💡 BEGIN CUSTOM TEMPLATE OUTPUT from 'themes/custom/ww_radix/templates/field/time.html.twig' --> <time datetime="2024-11-04T03:25:37+00:00" title="Monday, November 4, 2024 - 03:25">4 November, 2024</time> <!-- END CUSTOM TEMPLATE OUTPUT from 'themes/custom/ww_radix/templates/field/time.html.twig' -->

Similarly, the body field prints out the whole content and not the trimmed version I set up in the View. This can't be the right way of doing things.

14 Comments
2024/11/05
15:32 UTC

8

One man businesses/small shops: how do you charge for updates/maintenance?

Hi, I am a one man business which is focussed on Drupal; most of my work consists of consulting/project management/design/site building/dev with occasional module development if necessary.

But of course I also provide updates for the sites i created.

Now some clients (the ones who need permanent adaptions/new functionality/changes) pay a fixed fee per month for dev/updates. But some smaller clients (who barely need changes once the site has gone live) pay per hour.

How do you deal with this? Do you follow a regular cycle such as every month (bugfixes and security fixes are made ~ once a month if I am not mistaken)? Or do you follow the minor upgrade schedule (~ every 6 Months)?

Or do you update on every alert from the update manager module? That might be a lot of updates with a typical numer of contrib modules...

(To be clear: Of course I update immediately if there are any security relevant updates available.)

I would like to know how you handle this things and how do you communicate it to the client/set up your contracts? TYIA!

7 Comments
2024/11/05
09:22 UTC

9

Which is the best Drupal hosting?

Hey everyone! I’m looking to set up a new website using Drupal and want to find the best hosting option. I've heard there are quite a few choices out there, but I’m particularly interested in performance, support, and any features that are specifically beneficial for Drupal sites. If you have experience with any hosting providers that you found particularly reliable or had a good experience with, I’d love to hear your recommendations. Thanks in advance!

63 Comments
2024/11/05
07:22 UTC

6

looking for freelance opportunity in Drupal.

Hello! I'm a Drupal developer with over 6 years of experience, and I'm currently exploring freelance opportunities in this field. I've worked extensively with Drupal, handling everything from custom module development and theme building to complex migrations and performance optimizations.

If anyone knows of freelance opportunities—whether it's a one-time project, ongoing maintenance work, or a long-term collaboration—I’d love to hear more! I'm eager to bring my expertise to new projects and help create top-notch Drupal solutions.

Thanks in advance for any leads or recommendations!

2 Comments
2024/11/05
06:54 UTC

2

Show fivestar rating module in view

Hi all. I am using D10 with the Fivestar 8 alpha module. I added a rating field to a node type. Now I want to show the rating widget in a view. I know this used to be possible years ago when I did something similar on D7 with php templates. How does one achieve this with D10 and twig templates? In the view definition editor the widget is shown as desired I just can’t get it into my twig template…

14 Comments
2024/11/04
20:47 UTC

1

Configuration entity not getting registered in Drupal 11

Trying to create a custom module which adds a form under system config.

Getting the following error :

The website encountered an unexpected error. Try again later.

Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException: The list_builder handler of the "etss2_business_info" entity type specifies a non-existent class "Drupal\etss2_business_info\BusinessInfoListBuilder". in Drupal\Core\Entity\EntityTypeManager->getHandler() (line 263 of core/lib/Drupal/Core/Entity/EntityTypeManager.php). Drupal\Core\Entity\EntityTypeManager->getListBuilder() (Line: 23) Drupal\Core\Entity\Controller\EntityListController->listing() call_user_func_array() (Line: 123) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber{closure}() (Line: 593) Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber{closure}() (Line: 183) Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76) Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53) Drupal\Core\StackMiddleware\Session->handle() (Line: 48) Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28) Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32) Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 106) Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85) Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 53) Asm89\Stack\Cors->handle() (Line: 48) Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51) Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36) Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51) Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 709) Drupal\Core\DrupalKernel->handle() (Line: 19)

2 Comments
2024/11/04
17:19 UTC

1

Two views pages with same paths and wildcards but different arguments?

I'm currently trying to create two different views pages, but both have the same path and wildcard setups. E.g both pages are /accommodation/%

However, one page deals with pricing so could be /accommodation/budget , whereas the other is location, e.g. /accommodation/zanzibar

The pricing page has a limited number of options (budget / mid-range / luxury) while the location page has lots of possibilities.

I suspect this is something to do with routes, but from my D7 experience this is not something I have used.

Could someone point me in the right direction to work this out. Thanks.

3 Comments
2024/11/04
17:12 UTC

0

Help with Drupal 7 update manual install

I work for a nonprofit with a very limited budget. My Drupal 7 website with a lot of custom stuff keeps crashing, I'm sure because it needs the latest Drupal 7 version update, which says it must be installed manually. WAY out of my little wheelhouse. Any suggestions as to where I could find a dev to do this and not have to do through a big company that will want a crapton of money?

8 Comments
2024/11/04
15:24 UTC

2

Theme Sources?

I'm super new to Drupal and looking for good themes for writers or small publishers. Can anyone recommend any that seem particularly good for text presentation?

Also, what's the general sentiment about themes from sites external to the main Drupal sources? I'm especially thinking about places like ThemeForest.net and CreativeMarket.com, but I'm definitely open to suggestions for good sources.

I'm too new to start trying to design my own, but, eventually, I think I'd like to get there, so any tutorials specific to Drupal themeing would also be appreciated!

11 Comments
2024/11/03
17:26 UTC

8

How are you building your Single Directory Components

An acquaintance of mine is doing StoryBook integration. I've had problems trying to get it to work.

On some projects I just created them and then immediately use them on templates? I stopped using SASS, but some people are just too used to it that they won't stop.

I'm trying to set PostCSS, but having some issues.

How are you all doing your work?

11 Comments
2024/11/03
05:56 UTC

11

Drupal with Next.js, is it an overkill?

I’m considering using Drupal as a backend with Next.js for the frontend for a new project. While I love the idea of leveraging Drupal’s powerful content management features alongside Next.js's performance benefits, I’m wondering if this combination is overkill for most use cases.

Has anyone here used Drupal with Next.js? What has your experience been? Are there specific scenarios where this combo shines, or do you think it complicates things unnecessarily? Any insights or advice would be greatly appreciated!

Thanks!

28 Comments
2024/11/01
19:46 UTC

3

CD Drupal

I was working on packaging Drupal into Docker images and deploying them in a Google Kubernetes Engine (GKE) cluster using GitHub Actions. Management requested that we isolate each namespace within a Google Cloud Platform (GCP) project, and the updated requirement was to run Drupal on a Compute Engine virtual machine (VM).

I need to understand the best practices for continuous deployment (CD) using GitHub Actions on a VM. I attempted to remove the existing portal directory and replace it by moving the new one from GitHub, but I know that isn't the best solution. I also tried using rsync, but I couldn't get it to work with the `gcloud compute ssh` command.

1 Comment
2024/11/01
17:35 UTC

1

Files not being used

I’m trying to find all files that truly aren’t being used by any other entity. In the file system the ‘Used In’ column isn’t helpful. It will say 1 place but when I click to edit the file and check the Usage tab the file is being used in 4 different nodes. Is there a way to find files that have the “There are no recorded usages” message? Like actual orphaned files. Can I do this without using a module? I even looked at the database tables to see if I could find a field that will show this true data but I can’t find it. I ran a query but it returns files not listed in the file_usage table and that just isn’t truly what I need because some files in the fu table aren’t actually being used but still show there because it’s accounting for the file entity itself. Any thoughts?

Edit: I looked at the file_managed, file_usage, entity_usage, node and media_field_media_document tables to see if there are any overlaps that would give me a way to crossreference and find these files. No luck so far.

11 Comments
2024/11/01
15:31 UTC

2

Gutenberg block custom category

In Wordpress/Gutenberg I can create a category for custom blocks like so:

/**
 * Adding a new category to the block editor.
 */
add_filter('block_categories_all', function ($categories) {
   // Adding a new category.
   $categories[] = array(
      'slug'  => 'my-category',
      'title' => 'My Custom Category'
   );

   return $categories;
});

What would be the equivalent for Gutenberg in Drupal 10?

5 Comments
2024/11/01
05:15 UTC

1

Trying to understand an attack vector

Howdy,

So one of my websites recently got hit with an attack that was generating a ton of 404 errors (23k in one day, 5x normal server traffic). The odd thing about this attack, was that the primary URLs they tried looked something like this:

/papers/aHlwZXJzb2

There are ~14 of these URLs attempted, with at least 1k attempts each.

At first we thought someone might have published a bunch of bad links to our side with a mal-formed URL shortener, but then as the volume increased, it was clear it was some kind of attack.

Is this just an attempt to DDoS the site? What other purpose would these bad URLs have?

Our logs didn't show anything else out of the ordinary, just the normal amount of brute force attacks that show up on a daily basis, so this was really odd.

Any ideas?

7 Comments
2024/10/31
22:01 UTC

9

EvolveDrupal NYC 2024: Shawn Duncan - HTMX: Hypermedia Powered Drupal

0 Comments
2024/10/31
20:39 UTC

10

First Drupal production deployment : Looking for advice

Hello,

I'm preparing to put my Drupal project into production for the first time alone and have started planning my steps. I’d like to hear from you guys about what you typically do before going live.

What are your key tasks ? How do you handle clearing test data from your databases? Are there specific tools or protocols you recommend? Any best practices ?

As part of my preparations, I'm planning to write cleanup scripts to automate the removal of test data from my database. I'm also going to use Git for version control and Composer during the production process.
My clients are going to fill the preproduction website will all the content before launch and i'm planning to copy that database during the production deployment.
I'm using a single vps with Plesk for both preproduction and production.

I'm afraid to miss something important or do something the wrong way.

I appreciate any insights you can provide.

Thank you!

20 Comments
2024/10/31
13:52 UTC

Back To Top