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

is there a way to invalidate cache for published or promoted content

Hello,

I am trying to invalide cache when a node is updated using a hook_node_presave:

/**
 * Implements hook_node_presave().
 */
function mymodule_node_presave(NodeInterface $node) {
  $tags[] = 'node:' . $node->id();
  Cache::invalidateTags($tags);
}

The reason I am invalidating the content is because I have query that is running under a template file in order to get and display the top 5 most recent content. Everything works as expected for any updated content.

Error in 'hook_email_registration_name ()'

I want to use Email Registration so that my username is also my email address.

function custom_username_email_registration_name($edit,$account) {
  return $account->mail;
}

But I get an error.

ArgumentCountError: Too few arguments to function custom_username_email_registration_name(), 1 passed and exactly 2 expected in...

How can I solve it?

Call Back

In a content type I have various fields including a date field and a time field. Both call their respective callBack.
The problem arises when I try to write the Date via the keyboard and not via the widget. Every time I type a key the callBack is invoked and it's boring
This is the code
              $form['field_data']['widget'][0]['value']['#ajax'] = [
              'event'           => 'change',
              'disable-refocus' => FALSE,
              'callback'        => 'CBDataMiss',

Attaching submit handler to entity_autocomplete

I am working on some form api functionality in where there is an entity_autocomplete that populates based on a view. I am trying to attach some additional ajax/submit functionality to this so that once an entity is selected, it submits the ajax request/form to do some additional things. 

(For example, if a certain entity type is selected from the autocomplete, additional fields show up). #submit doesn't seem to work on entity_autocomplete, and you can't rebuild form_state (or set it) in the ajax callback, so I am trying to find another way to do what I need. 

Changing Url of the website in the subfolder from htaccess

Hi,

Thank you to an amazing Drupal Community here. It has been a great help to build our website on Drupal. But we have a specific issue:

Our website is on the current url: https://iasmantra.com/dev-dgb/web/
(The public-html folder has many other websites, then in dev-dgb folder within the web folder the drupal files are)

Drupal 9.2 and Paragraph module

I am working on drupal 9.2 with the paragraph module. I want to remove the delete button that appears on the right of the form during user input because this delete button does not make sense for the end user who does not need this. Where and how to remove this button that appears on each paragraph content.

It's urgent.

Thank you to all of you

share

Pages

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