Drupal 自定义模块路由问题

问题描述

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

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": ...

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

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)