New answers tagged


The concept of disabling modules (separate to uninstalling them), did exist in Drupal 7, but it was removed in Drupal 8. You will either need to uninstall the modules, or find a different way to disable the specific behaviours which are causing you problems, via events/hooks/etc.


Okay, searching thru core services found this. We can clear all the library definitions like this. \Drupal::service('library.discovery')->clearCachedDefinitions(); See Drupal Reference of this method: Reference Calling this function Clears static and persistent library definition caches.


The comment module provides a permission, "Post comments" (post comments). Before using any code option, you should remove that permission for anonymous users.


I added this inside my hook and it worked: if($form_id == 'comment_comment_form') { if (\Drupal::currentUser()->isAnonymous()) { $form['comment_body']['#access'] = FALSE; } }


This doesnt allow dynamic information e.g. node title, node type - unless you use global functions for pulling the node from the url rather than as a parameter.

Top 50 recent answers are included