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

Dynamic update Selection List field

I have to update a Selection List field (field_categoria - Entity Reference) dynamically according to the choice made in another Selection List (field_type_operation - Text List).
In the call Back I wrote this Code but it does not update the List
List of the field_category field.
I did the test directly in form_alter and it works for me

How to create a view, getting arguments by url?

Hi friends

I'm using drupal 8, I've created a content type with 3 languages translator,
and then i've created a REST export view and i added those fields,
but i would like to know how to get those items passing a parameter by url,

for example /news?language=en that will get the nodes that are in english,
and /news?language=fr that will get the nodes that are in french

how can i get that parameter and use it on my views to get that items?

Could you please help me?

Regards
Mario

How to submit a new module (and related questions)

Hi,

at my office we are preparing D7→D8/D9 migration. We make large use of Generic Jammer module (a submodule of https://www.drupal.org/project/jammer), which is not maintained anymore (and not ported to D8).

I rewrited this submodule, including many new features I created for Generic Jammer but which was never integrated. Still not ready for production, but all the features are present.

So my questions:

Use group module - in my own custom module

I am using the Group module, and are developing a custom module from where I need to programmatically add and remove users from groups.

I have been trying to do the following (should be fairly simple from what I can understand) 

$group = \Drupal\group\Entity\Group::load($gid);
$user = \Drupal\user\Entity\User::load($uid);
$group->addMember($user);

But when I run this code, I get an error:

Run a script in the background that IS NOT CRON

I have some scripts that I need to run manually, these scripts are not meant to be ran on a regular schedule, therefore, I DO NOT want to use cron. With that, how can I kick off a php script in the background?

I've tried to use `exec` but it doesn't know what drush is, so I can't run my script that needs ran via drush.
I looked into the `Background Process` module but 1) it hasn't been updated in years and 2) it doesn't have a Drupal 8 version. 

How can I run a script in the background that isn't done through cron?

Tutorial: Custom Block Visibility Plugins and the Condition Plugin API

I've created a tutorial on creating custom block visibility plugins, shown in the vertical tabs on block configuration pages. The tutorial can be seen here: https://www.jaypan.com/tutorial/custom-block-visibility-plugins-and-cond...

Pages

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