Drupal 自定义模块路由问题

时间:2021-07-18 06:48:11

标签: drupal drupal-8 drupal-modules drupal-routes

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

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

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

0 个答案:

没有答案
相关问题