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

Default values in form_alter

Drupal 8.8.5

In form_alter I insert this code to assign a default value to an Entity reference field
$form['field_localita_partenza']['widget'][0]['target_id']['#default_value'] = 'ROME';

During the insertion phase, I change Rome In Milan but when I save it forces me to value ROME and not MILAN.
I have done various tests but without success.
I don't understand why it doesn't work

Programmable text pages?

This might be an unusual question. Is it possible to generate text in Drupal based on variables and 'if then else', and preferably also 'switch case1 case2 ...'?

ubercart module show out of stock ad in store

good morning

I am developing a store in drupal and I would like to know if there is a way to show me a label on a product that was previously no longer in stock.

I am using the Ubercart module and drupal8. for drupal 7 I found a module that does what I want and I would like to know if there is any way to do it in drupal8

slds

Migrating menu from D7 custom module to D8

Hello folks, my first post here in the community.

I have a custom module for my D7 site, what I do in this module is create a entrance in the hook_menu with a item without call back. Them I have others items being a "sub-item" of the first, something like this

Displaying form with a controller in a module

I made a module with a form called SimpleForm which consisted of 2 textfields and a submit button. However, I cannot open the form using the path, it always throw HTTP error 500. I also couldn't show the form on my twig file. Can someone please have a look at my code and give me a proper explanation? Thank you beforehand.

honda_model.routing.yml

Field Settings

I've recently run into an issue where after the website was launched. The web address within the iFrame changed in turn dis-configuring the graphics in the content structure. Is there a way to update this without using the hook_update? I'm just learning Drupal out of necessity to update the website.

Thank you in advance!

Pages

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