0

我制作了一个自定义模块,它应该作为模板的一部分呈现并且它可以工作。

test_form.open_test_form:
  path: 'test-form'
  defaults:
    _title: 'Test Form'
    _controller: '\Drupal\test_form\Controller\TestFormController::openTestForm'
  requirements:
    _permission: 'access content'

问题是通过加载路径直接调用模块loacalhost/test-form将得到以下响应作为文本区域。

[{"command":"settings","settings":{"pluralDelimiter":"\u0003","suppressDeprecationErrors":true,"ajaxPageState":{"libraries":"core\/drupal.dialog.ajax,core\/jquery.form","theme": ...

如何处理它以在模板内显示为块并防止直接访问模块路径?

4

0 回答 0