This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

THIS FORUM IS NOT FOR "What module..." or module support questions-- it's for module development and code related questions.

The module development and code questions forum is intended to aid those who are developing modules or writing code for Drupal.

Please note that this forum is also not intended for "Is there a module that does..." or "I need help with module x..." questions. It's also not a place to ask developers to write your code for you. Please respect this.

Please do not post general discussions intended to target module developers. If the question you have isn't specifically related to writing a drupal module, please post it in a more appropriate forum.

  • If you you have drupal installed already and are seeking a module that does a specific task, have a question about a specific module and what it does or if it will fit your use case, please place your questions in the Post installation forum.
  • If you have a problem or question about a specific module, you should create an issue in the module's issue queue (after checking for an existing issue first).
  • If you don't have drupal installed yet, please place your questions in the Before you start forum.

Where to find BaseFieldDefinition:: Properties

I am playing with code to define base fields in a custom entity created in a module.  For example...

Updating language for existing content

Hi friends,

I have multilingual site. And there are content originally created in 'es' (Spanish) language. Now, we have to change all those existing content to 'en'. In my custom drush command, tried below thing but now working --

After loading the node object trying to change it like this --

$node->set('langcode', 'en');
$node->save();

It is giving this error --

Integrating a Jalali (Shamesi) Calendar Datepicker into Drupal Commerce Marketplace Vendor Forms

Hello Drupal Commerce community,

I am developing a multi-vendor marketplace for a client in Iran and Afghanistan, where the official calendar is Jalali (Solar Hijri / Shamsi). I am using Drupal Commerce with the Commerce Marketplace module as the foundation.

How to Pass Dynamic Data Between Drupal Modules Safely?

Hi everyone,

I am developing a custom Drupal module and I need to pass data dynamically from one module to another. For example, Module A generates some user-related data, and Module B needs to use it for custom processing.

Here’s a simplified scenario:

// Module A
function module_a_generate_data($uid) {
$user = \Drupal\user\Entity\User::load($uid);
return [
'username' => $user->getAccountName(),
'roles' => $user->getRoles(),
];
}

Creating node in php script run outside the site UI

I am trying to create content by a script running outside Drupal. I know this is possible, and probably done better, using REST. But the script below is so simple to set up and works very fast that I'd like to try and get it to work in D10->, like it did in D7.  

This code (from the final entry in this post), works to retrieve user and node data, running, for testing purposes, inside the Drupal root folder...

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions