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

states in form_alter

I am using the states on a field of a content type but I get this error

js file loaded in form where js file not listed in library

I have the following in my mymodule.libraries.yml:

user:
  version: 1.12
  js:
    js/set-office-name.js: {}
    js/password.js: {}
  css:
    component:
      css/bnc-user.css: { minified: false }

contact_log:
  version: 1.12
  js:
    js/set-office-name.js: {}
    js/enable-district-office.js: {}
  css:
    component:
      css/bnc-user.css: { minified: false }

In my module.modules I have two hook_form_alter functions where I set the libraries used:

1) mymodule_form_node_bnc_message_form_alter:

How to programmatically append fields to node object when cloning with createDuplicate()

I’m trying to setup a custom module which clones the content from NODETYPE_A to NODETYPE_B. For most part, both nodetypes use the same fields, but NODETYPE_B has a few additional ones. For example:

NODETYPE_A:
- Title (title)
- Body (body)
- Date (field_date_agenda)

NODETYPE_B:
- Title (title)
- Body (body)
- Date (field_date_agenda)
- Number of items (field_int_how_many)
- Reference to NodeTypeA (field_noderef_nta)

Tips and Tricks for Drupal development ?

In older php days, when I got stuck developing code, I would just output some things to the screen.

That's isn't possible anymore with all the layers.

How do you look into objects?

Do you write things to a text file or are there other tricks?

For example, I'm in the middle of some code and I want to look into $responsive_image_style->getKeyedImageStyleMappings();

How can I have a look at what's inside?

Responsive Images, breakpoints, image styles...

I'm playing around with the CSS Aspect Ratio module, and there seems to be a bug.

This code produces always the same result, but it shouldn't:

Jquery.once is deprecated, need help for code rewriting.

core/jQuery.once is being deprecated in core.
https://www.drupal.org/node/3158256
1 Need help rewriting some lines of code using the core/once library.

Old:

  
$('.hub-recettes').find('input').once('recomandation-filter').on('ifChecked ifUnchecked', function (event) {
      $('#views-exposed-form-hub-recette-page-1').submit();
    });

New:

Pages

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