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

Unit Tests - Class to be tested not found

Hello,
I am trying to understand Unit testing (Drupal 9). To this purpose I am going through the pertinent chapter of Daniel Sipos' book "Module Development". Somehow class Calculator is not recognised. Here comes a code snippet of both CalculatorTestClass and Class Calculator (to be tested).
(1) from file ~/drupalroot/web/modules/custom/hello_world/src/Calculator.php

Required field state not working

Hello, new with Drupal, doing my first project on it. I'll try to be as short as possible.

I have a form field, type file, which by default is required. And i want this state to change based on another field's state. More precisely, a checkbox type field. You can see the problem in this image (follow the links for the images, sorry but i didn't manage to understand how to embed an image on this forum):

https://ibb.co/zNfG7yP

How to call a function of a contributed module in my custom module

I want to use the return value of a function used inside another, contributed module – but i don't know how to get there ... :-(

Query, multivalued field in condition

I need to filter some data in bae to a multivare Entity reference field.
If I have to filter an entity reference field for a multivalue I have understood how to do it but I have not understood how to do the opposite.
The field is an entity reference field_categoria, multivalued entity reference, I tried various possibilities but none of them work for me

How to create comments with REST API

Hi,

After reading a lot of posts, testing with postman several things I still can't figure out
how to use the REST API for creating content and more generally how to use the core REST API.

Where I am until now

I'm just trying to create a simple page as a starting point.

In the header section of POSTMAN :

'Content-Type': 'application/hal+json',
'X-CSRF-Token': 'MYTOKEN FROM /session/token',
'Accept': 'application/hal+json',

In the body section of POSTMAN :

Enable contact form for blocked user

The use-case is a brochure website with means to contact some people.

The only person that shall be able to log in is the content editor.

I want to enable a personal Drupal contact form for each department head.

I've created user accounts for all department heads.

However, they shall not be able to log in, or to request a password reset.  Therefore, I've set their status to "Blocked".

Pages

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