【问题标题】:Redirects to external URLs are not allowed by default默认情况下不允许重定向到外部 URL
【发布时间】:2017-07-12 06:53:27
【问题描述】:

默认情况下不允许重定向到外部 URL,请使用\Drupal\Core\Routing\TrustedRedirectResponse

我在 Drupal 8 中启用我的自定义模块时收到此错误。

【问题讨论】:

    标签: drupal-8


    【解决方案1】:

    检查你 routing.ymlmenu.yml 您创建的路由名称应该在menu.yml 中,例如:

    在routing.yml中

    test_module.description:
      path: 'testing/new-example'
      defaults:
        _controller:  '\Drupal\test_module\Controller\Page::description'
        _title: 'Form API Examples'
      requirements:
        _permission: 'access content'
    

    在 menu.yml 中

    test_module.description:
      title: Form API Examples
      description: Form examples using Drupal Form API.
      route_name: test_module.description
    

    【讨论】:

      猜你喜欢
      • 2018-08-17
      • 2021-12-11
      • 1970-01-01
      • 1970-01-01
      • 2010-12-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多