When I was porting Mollom to drupal 8 I noticed that when I did a hook_form_alter, it wasn’t showing the comment form ID as debug information. An important detail is that the page was viewed by an anonymous user.

mollom.module

function mollom_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
  print_r($form_id);

Luckily the solution was quite easy:

settings.php

$settings['container_yamls'][] = DRUPAL_ROOT . '/sites/development.services.yml';
$settings['cache']['bins']['render'] = 'cache.backend.null';

drush

drush cr

And done! Now we do see all the debug information. It’s due to the render cache that caches certain forms. Now enjoy porting your Drupal 8 module!

Disable caches for Drupal 8