/r/drupal
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.
The place for news, articles and discussion regarding one of the top open source (GPL) CMS platforms: Drupal.
More Info: Drupal.org
Would you or someone you know make for an interesting Drupal AMA? Message the mods.
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
/r/drupal
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!
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.
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.
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?
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:
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?
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!
The site I'm building mostly has sections with static content. There are a couple of sections where we're displaying featured posts and forms but other than that, the rest of the website doesn't need dynamic content. Because I'm new to Drupal, I'm trying to make things as simple as possible for now. Also, the site has quite a few complex design elements and some fancy animations so, I'm probably better off using HTML and CSS instead of trying to make things work with Gutenberg and the like.
Initially, I opted to build an entire static page as a single block (I'll break things down when I can reuse a block, of course). I created a block called About us and then wrote the HTML markup in the Twig template and the CSS in a .scss file. So far so good. But the problem I ran into pretty quickly was when I wanted to access some images I uploaded earlier (as media items) to include in the <img> element. It wasn't a problem when I was setting a background image from CSS as I could keep the required images in the /src/assets/images directory and just use them on the stylesheet located at /src/assets/scss.
Should I create a custom block with a field that accepts multiple images so I can access them on the Twig template to display on the page? Or is using blocks to build pages a bad idea, to begin with? I can also think of other drawbacks like how tedious it could get to manage when you have 10+ pages and each page has at least a few blocks. The Block layout page would then become very hard to work with as you'd be listing all the numerous blocks in the main content region of the page, for instance.
Would appreciate any pointers on this!
Hi, hoping you might be able to help
I have a site that has historically used form mode routing module, but this module is not compatible with Drupal 10+ which we've upgraded to, and I believed that Drupal 10 would natively be able to handle routing forms etc
I have tried a few options but cannot get the routing to work. We have a custom module that handles user profile views, and these views can be viewed, but the issue is 1) the editing of these views and 2) the forms are not always displaying.
For the routing, I've added the routing logic to the custom_module_routing.yml file, and checked the controllers. I've even tested: an additional edit controller and also tested using a hook form alter in the main module.yml file
So, I wondered if 1) there are alternate ways to handle this, and 2) if actually the issue is likely the form display ?
I am new to Drupal, so likely this error(s) are small or simple to fix
Hi!
I’ve been out of the Drupal game since version 8, but I have many years of experience with all the underlying libraries, like Symfony and Twig.
I have at least 5 projects we want to move to Drupal, and I was wondering if I should use Drupal 11 or stick to version 10 for now.
Some of the projects will have Commerce enabled, and ideally all of them should have the Webform module. According to the docs, Commerce should be fairly stable with Drupal 11, but Webform seems to be a bit iffy with the latest version.
What would you guys recommend? Is it worth going with Drupal 11 and use Typeform instead of Webform for now, for example?
Thanks!
Hey Guys,
I know D7 will be EOL soon.
However, I need to build a custom module that would allow me to accept payments from PlugNPay.
2 yrs experience so far with d9 and d7.
I'm currently building it like a plugin for ubercart. I've been making some progress but not much resources online.
Has anyone built something similar? I would appreciate any help with this, resources, advice and/or repositories.
I've been wrestling with this for weeks.
ok so I am working in Drupal 10, converting a D7 site. There is a view that has a field for 'user roles'... On the D7 site, when you add 'user: roles' as a field in the view, it gives you the option to "only display the selected roles", but this does not exist in the D10 version of Views for whatever reason. What I need seems very simple but I cannot figure out how to make this happen with Twig... basically what I am looking to have happen is this:
Only display the specific User Role in the view, then I want to rewrite the results to print out some custom text. Obviously the rewrite results works the same way as D7, but I just need some help in how to make this field with multiple variables only display the one I want it to.
How can I accomplish this with Twig?
Is there a way in Drupal 10 with a custom content type to add a group of fields that can be unlimited without creating a whole new content type?
+add new row
(see title)
I need a view that lists nodes/entities which contain a specific media item. My nodes all contain different paragraphs which have different fields, but they all contain a media field.
I need to list all nodes using a specific media ID.
i thought of making a view of media items, filtering it to the ID, and then adding a relationship to the entity it's on but I can't get it to work the way I need.
any help?
I need to hide some taxonomy terms as options in a field on a specific content type, and the way I'm doing it is the form alter hook:
/**
* Implementation of hook_form_FORM_ID_alter().
*/
function my_module_form_node_form_alter(&$form, FormStateInterface $form_state)
{ $form_id = $form['#form_id'];
if ($form_id == 'node_article_with_paragraphs_edit_form') {
...
}
}
This works when editing a node, but it doesn't work when creating a new node. How can I achieve the result so that it works both on editing and creating this kind of content?
For context, I'm a Drupal newbie, but a generally experienced software developer. I'm helping a voluntary organization to move to Drupal 10.
There's several hundreds of old articles they want to keep. I found it pretty easy to just take a database dumb and then parse the body content and metadata for to-be-migrated pages to files and then push those files as pages to Drupal using JSON:API. This let me kind of sidestep getting a deep understanding of the actual migration tools.
The JSON:API plugin though does not let one modify menu entries.
Is there some relatively easy way of automatically adding a page under a given menu level, in a way similar to how it would be done through the UI?
(Another task still to be done is moving all the image files but that I assume is relatively easily done over FTP and just making a script that updates the image URLs..)
Hello guys, I’m kind of stuck at making my created content types accessible at jsonapi endpoint. What I could only get is the content type endpoint, that contains all content. What I actually need is the endpoint of sub content. Here’s the structure: Content type is say About Us (added fields are image and body text as desired for the contents to be used). Then, I added four contents to About Us content types. From Drupal frontend these four contents are dynamic and when clicked they display text and image of their own. But in jsonapi I don’t have these four contents. Only About Us endpoint which displays those four contents and they’re not dynamic. I have tried to enable permissions, I’d appreciate any help. Thanks!
I registered on Drupal.org, which seems to be the right step to access the Drupal Slack channel. However, when I tried to sign up, it required me to have an email linked to Drupal. Unfortunately, I can't register with my personal email.
At the bottom, it states that I can use any account with the following domains: association.drupal.org or socialenterprises.net.
Am I doing Slack wrong? I am fairly new to it and haven't touched it in ages.
Hello!
The only information I can find on this topic is from D7, but now I'm using D10. (https://www.jeffgeerling.com/blogs/jeff-geerling/adding-images-search-results) Doesn't really seem to apply. Curiously there appears to be no obvious wayto get images to show in search results. For example I have an Article content type with eaach node having an image + text. I would like a teaser of that image to show up in search results next to the node titles/summary etc.
I am also using Twig which probably complicates things. Possibly info here: https://www.drupal.org/docs/contributed-modules/inline-formatter-field/common-twig-patterns#s-images
I am semi knowledgeable but also not expert enough to just figure it out myself. If anyone has tips or could point me in the right direction I would really appreciate it. Thank you!
Hello,
IM thinking of learning Drupal by using the courses on this page : https://www.youtube.com/@AcquiaTV
But I wonder if there are sites with challenges so I can practice things that I learned ?
looking for a managed hosting provider for a fairly large site with new blogs published daily with over 15m views a month. Need things like a solid firewall, 24/7 support, stage environment, logs etc.
ya ya i get the big providers are the 'best' but I don't have that budget. I have come across Cloudways + AWS and looking into it so if you have any experience with them let me know too.
edit: doesn't need to be super cheap but $35-40k a year plus minus would be good
Hello,
I've got a data prep system for content which is going through a couple of stages.
A bit like silver / golden record concept on databases.
I'm wondering, whether Drupal would be helpful here as a way, to:
Advantages that I see, switching from DB to CMS:
Disadvantages would be obvious for all developers I guess:
So far, I've been running the data prep system for ca. 1 year, and I've got ca.
300k golden records
7.144.782 silver records
197.684.602 "bronce" records (whereas those wouldn't need to be in Drupal, could act as the source for the trigger into Drupal or be deleted after disqualifying them weekly or so)
And I'd like to speed things up / grow the data faster
ca. 10 - 20 mio records per year, maybe 2 - 3 users of the system, no external / anonymous traffic (all behind htaccess e.g.), constant API traffic
I found this 4 year old post: https://www.reddit.com/r/drupal/comments/h7ttut/maximum_number_of_nodes/ which made me wonder, what Drupal can handle without traffic.
What's your thought on this?
I have a small project and for the life of cannot get the custom theme to build either off of yarn or npm/nvm
npm - version 8.19.3
node - version v18.13.0
i keep running into upstream dependency errors with sass and sass-loaders. If anyone could maybe hop on a dm or guide me through on a 1 on 1 session that would be great. thanks.
In my Drupal 10 View, I have a Custom Text field with a <div>
that looks like this:
<div class="owl-carousel init-carousel-owl owl-loaded owl-drag" data-items="1" data-items_lg="1" data-items_md="1" data-items_sm="1" data-items_xs="1" data-loop="1" data-speed="800" data-auto_play="0" data-auto_play_speed="900" data-auto_play_timeout="5000" data-auto_play_hover="0" data-navigation="1" data-rewind_nav="0" data-pagination="1" data-mouse_drag="0" data-touch_drag="0">
The View's output is rewriting some of the data-
attributes by removing the data-xxx_
part. So, for example, this...
data-auto_play="0"
...becomes...
play="0"
It seems to only affect the data-
attributes that have an underscore _
in their name. See the example above, but an attribute like data-pagination="1"
would not be rewritten.
Why is this happening? And more importantly, how can I prevent it?
UPDATE: The Views Addons module seems to have solved this issue for me. Googled for hours, was about to give up, and then somehow I stumbled upon this module. After enabling, just add an Advanced Custom Text field to your view.
As an honorable mention, it looks like Views Unrestricted Custom Field module would have worked too, but it's got a scary warning on the page about not being covered by Drupal's security advisory policy, so use at your own risk.
I'm upgrading a Drupal 10 site to 11. When I go to run the database update ...
> vendor/bin/drush updated
I get this error: "Currently using Removed core module You must add the following contributed module and reload this page. Color"
I see a similar error when attempting to run the update through the site menu.
I then try to install the "Color" contrib module it points to:
> composer require 'drupal/color:^1.0'
...and I get error messages that it requires Drupal 9 or 10.
I actually don't even know why I would need this module, in the first place. I'm reading that it was deprecated in Drupal 10, and I don't think any of my Themes use it.
Any suggestions on where to go from here? Should I ignore Composer and just install the tarball?
EDIT: Solved via "drush generate module"
Opigno, an LMS based on Drupal, just released its latest version, which is compatible with D10. Great. I'm trying to upgrade from Opigno 3.1/D9.5 and failing. I've read and re-read their documentation and I can't figure out how to upgrade.
Here's the doc: https://opigno.atlassian.net/wiki/spaces/OUM3/pages/3438116866/Upgrade+to+3.2.x+release+Drupal+10
Here's the relevant step I'm stuck on:
composer require drupal/upgrade_status
Since there are no Opigno forums, I'm stuck posting here. If anyone can help me solve this and feel like less of an idiot, I would appreciate it. My questions:
OpignoLms 3.1.3 update requires the group module to be updated to version 1.5 so that it can be upgraded to Drupal 10.
There is no "group" module that I can find listed in the composer.json. No idea what this is talking about.
Resolve all dependencies before upgrading to Drupal 10 and OpignoLms. Note that Opigno_lms >= 3.2.x only supports Drupal 10 (after Drupal 9 became deprecated).
How does one do this? I've tried running composer update --with-all-dependencies which fails.
composer update --with-all-dependencies
Composer could not detect the root package (opigno/opigno-composer) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- opigno/opigno_lms 3.x-dev requires drupal/color 2.x-dev -> found drupal/color[dev-2.x, 2.x-dev (alias of dev-2.x)] but it conflicts with your root composer.json require (^1.0).
- Root composer.json requires drupal/commerce_paypal ^1.8 -> satisfiable by drupal/commerce_paypal[1.8.0, 1.x-dev].
- Root composer.json requires opigno/opigno_lms ^3.2 -> satisfiable by opigno/opigno_lms[3.2.7, 3.2.x-dev, 3.x-dev].
- opigno/opigno_lms[3.2.7, ..., 3.2.x-dev] require drupal/commerce ^2.27.0 -> satisfiable by drupal/commerce[2.27.0, ..., 2.x-dev].
- You can only install one version of a package, so only one of these can be installed: drupal/commerce[dev-2.x, dev-3.0.x, 2.0.0-alpha1, ..., 2.x-dev, 3.0.0-alpha1, 3.0.0-beta1, 3.0.x-dev].
- drupal/commerce_paypal[1.8.0, ..., 1.x-dev] require drupal/commerce ^2.40 || ^3 -> satisfiable by drupal/commerce[2.40.0, 2.x-dev, 3.0.0-alpha1, 3.0.0-beta1, 3.0.x-dev].
- Conclusion: don't install drupal/commerce 2.40.0 (conflict analysis result)
I've tried installing the upgrade_status module, which similarly fails.
It feels like a chicken and egg situation, do I try to upgrade Drupal first or Opigno first? I just find the whole thing confusing. Any help is seriously appreciated.
Opigno, an LMS based on Drupal, just released its latest version, which is compatible with D10. Great. I'm trying to upgrade from Opigno 3.1/D9.5 and failing. I've read and re-read their documentation and I can't figure out how to upgrade.
Here's the doc: https://opigno.atlassian.net/wiki/spaces/OUM3/pages/3438116866/Upgrade+to+3.2.x+release+Drupal+10
Here's the relevant step I'm stuck on:
composer require drupal/upgrade_status
Since there are no Opigno forums, I'm stuck posting here. If anyone can help me solve this and feel like less of an idiot, I would appreciate it. My questions:
OpignoLms 3.1.3 update requires the group module to be updated to version 1.5 so that it can be upgraded to Drupal 10.
There is no "group" module that I can find listed in the composer.json. No idea what this is talking about.
Resolve all dependencies before upgrading to Drupal 10 and OpignoLms. Note that Opigno_lms >= 3.2.x only supports Drupal 10 (after Drupal 9 became deprecated).
How does one do this? I've tried running composer update --with-all-dependencies which fails.
composer update --with-all-dependencies
Composer could not detect the root package (opigno/opigno-composer) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- opigno/opigno_lms 3.x-dev requires drupal/color 2.x-dev -> found drupal/color[dev-2.x, 2.x-dev (alias of dev-2.x)] but it conflicts with your root composer.json require (^1.0).
- Root composer.json requires drupal/commerce_paypal ^1.8 -> satisfiable by drupal/commerce_paypal[1.8.0, 1.x-dev].
- Root composer.json requires opigno/opigno_lms ^3.2 -> satisfiable by opigno/opigno_lms[3.2.7, 3.2.x-dev, 3.x-dev].
- opigno/opigno_lms[3.2.7, ..., 3.2.x-dev] require drupal/commerce ^2.27.0 -> satisfiable by drupal/commerce[2.27.0, ..., 2.x-dev].
- You can only install one version of a package, so only one of these can be installed: drupal/commerce[dev-2.x, dev-3.0.x, 2.0.0-alpha1, ..., 2.x-dev, 3.0.0-alpha1, 3.0.0-beta1, 3.0.x-dev].
- drupal/commerce_paypal[1.8.0, ..., 1.x-dev] require drupal/commerce ^2.40 || ^3 -> satisfiable by drupal/commerce[2.40.0, 2.x-dev, 3.0.0-alpha1, 3.0.0-beta1, 3.0.x-dev].
- Conclusion: don't install drupal/commerce 2.40.0 (conflict analysis result)
I've tried installing the upgrade_status module, which similarly fails.
It feels like a chicken and egg situation, do I try to upgrade Drupal first or Opigno first? I just find the whole thing confusing. Any help is seriously appreciated.
Hi guys, I am very newbie in Drupal - need some help to take the first steps. So, I built a server on a virtual machine; I want to create a simple form with a list to access the database (Postgresql) and display the results of the SQL query in this list. Tell me, please, what is the easiest way to do this? Thanks.
A general FYI in case anyone comes across the same issue.
I'm in the process of upgrading some sites from Drupal 7 to Drupal 8 (because I already have a working multi-site D8 codebase - which will be upgraded beyond that after).
Various modules on both the D7 and especially the D8 site have got stuck at certain versions - because of my PHP version.
My PHP version was stuck at 7.1 - any time I upped the version, the D7 sites would whitescreen.
I looked at the Drupal 7 specs and it should have gone beyond that. I looked at the modules to see if one of them was causing the issue. I swapped out custom themes to see if that was the problem.
After a lot of messing about I finally found the culprit - successive site upgrades (one of these sites started on Drupal 4.5 back in 2005) had updated every file... almost... It was the site's settings.php files - at some points these had been upgraded, but clearly not for a long time - because things worked and the upgrades tend to touch everything other than the site's own subdirectory.
I renamed these files, let Drupal pull a new one from default the next time I tried to access the site - entered the DB details and now everything is working fine up to PHP 7.4, ready for the next step of the upgrade process.
Hey everyone,
I’ve been a Web Developer for over 10 years, and I know my way around the usual suspects—HTML, CSS, JavaScript, and a few frameworks. But my company just threw me into the deep end by switching to Drupal, which feels like a whole new planet to me. So, I’m officially taking the plunge and plan to learn this beast and get certified.
The only problem? I have no idea where to start, or where to even find the Drupal certification exam! Any helpful hints (or rescue boats) would be greatly appreciated!