I'm preprocessing a paragraph to add a custom form but I'm having trouble with the visibility. I don't need any fields on this paragraph.
If I just add the form to the paragraph the whole paragraph is hidden for anonymous users.
function my_module_preprocess_paragraph__my_paragraph(&$variables) {
$paragraph = $variables['paragraph'];
$form = \Drupal::formBuilder()->getForm('Drupal\my_module\Form\MyCustomForm');
$variables['content']['form'] = $form;
}
However, if I add a title field to that paragraph everything shows up fine. Is there a way I can get the form to show without having to add fields?