I include some form from API. And I want to include it in block, using Drupal\Core\Block\BlockBase. My function return HTML tags, that has tag <form>.

But function build() return empty array.

$element = array(
  '#markup' => $html
return $element;

1 Answer 1


You will have to include your tags in the #allowed_tags, because this markup is filtered in Xss::filterAdmin.

$element = [
  '#markup' => $html,
  '#allowed_tags' => ['form', 'input', ...]
return $element;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.