Suitable way to hide a paragraph entity I have read Hide an entity with hook_entity_view_alter(), and by all rights this code should hide every paragraph on a page:

/**
 * Implements hook_ENTITY_TYPE_view_alter().
 */
function mymodule_paragraph_view_alter(array &amp;$build, EntityInterface $entity, EntityViewDisplayInterface $display) {
  $build['#access'] = false;
}


There are no errors, I know the function is being called because the debugger stops there on a breakpoint, I've cleared cache with every test.

I've tried hook_entity_view, hook_entity_view_alter, hook_ENTITY_TYPE_view and hook_ENTITY_TYPE_view_alter.

None of them have any effect whether I'm logged in or not.

['#access'] is not showing up in the build array in any of these hooks which makes me think the advice might be out of date since 8.4 dropped? If it does work - why should it work?

Are there any other ways, better ways of hiding paragraph entities (or any entity really)?

Obviously there will be some logic involved later which is why I want to do it in one of these hooks (or similar).



Edit 1: It has been suggested that there should be a $build['content'] array or similar. There is only the entity object in whichever hook I try of the four I have listed:
Try this:

$build['#printed'] = TRUE