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

Custom form

Hi, I have an array that I need to loop to update the nodes with the values ​​of a field from another node
This is the code
foreach ($ nNodiDispo as $ nidDispo) {

Automatic Node expiry email alerts

Hi

I administer a government website with close to 6000 assets - pages, documents, etc.

Is there a way that the system can automatically alert (email) these people and tell them to review their content?

Is this an out-of-the-box thing or is there a better add-on/module, et cetera.

What is the best way to ensure content stays up to date when you have a very large number of content owners?

Kind regards

How do I get the error string?

I have the following code in a hook:

$errors = \Drupal::messenger()->messagesByType('error');
foreach ($errors as $error) {
  // $text = $error->getMessage();
}

The commented out line in the loop is to get the string of the error message. It does not use the right syntax.

What is the right syntax in procedural code?

Plugin block Derivatives

Am having trouble with creating blocks on the fly via my module.

I found information about Derivatives and Block Plugins. So far I can get the blocks to appear in the “Place block” modal,
but when I click on the “Place block” button in the modal I get an error.

Redirect to front page from hook_node_insert()

I want to redirect the user to the website's front page at the end of hook_node_insert()

However, drupal_goto() is gone. How do I do this in Drupal 9?

I've found this depreciation notice: https://www.drupal.org/node/2023537 which shows how to do it in a callback.

But just copying the procedural code example like this:

callBack in custom form

Hi, in a custom form I have 2 fields, one date and the other text
In the date field I inserted a callBack to display the day of the week but it doesn't work.Here is the code of the module present in the buildForm function

Pages

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