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 that you have read and understand our privacy policy and code of conduct.

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