.menu_links.yml和.routing.yml

时间:2014-04-04 10:19:48

标签: symfony drupal-8

我已经将我的贡献移植到Drupal 8一段时间了,并且关于hook_menu_links_default被删除并且添加了menu_links.yml的最新更改,我被卡住了。即使我一直在研究核心模块的代码。长话短说,我的链接没有显示在/admin/config/system上。你能帮助我吗?以下是我的文件。

tcmb.menu_links.yml:

tcmb.tcmb_settings:
  title: Tcmb General Settings
  description: 'Configure Tcmb module.'
  route_name: tcmb.tcmb_settings
  parent: system.admin_config_system
  weight: 1
tcmb.tcmb_settings_currency:
  title: 'Tcmb General Settings'
  description: 'Configure Tcmb module.'
  route_name: tcmb.tcmb_settings
  parent: system_admin_config_system
  weight: 1
tcmb.gold_settings
  title: 'Gold settings'
  description: 'Configure Tcmb gold settings.'
  route_name: tcmb.gold_settings
  parent: tcmb.admin_config_system_tcmb_settings
  weight: 2
tcmb.other_settings:
  title: 'Other settings'
  description: 'Configure other settings.'
  route_name: tcmb.other_settings
  parent: tcmb.admin_config_system_tcmb_settings
  weight: 3
tcmb.other_settings_currency:
  title: 'Currency Settings'
  description: 'Configure other settings.'
  route_name: tcmb.other_settings_currency
  parent: tcmb.tcmb_other_settings
  weight: 1
tcmb.other_settings_gold:
  title: Gold Settings
  description: 'Gold Settings'
  route_name: tcmb.other_settings_gold
  parent: tcmb.tcmb_other_settings
  weight: 2

tcmb.routing.yml:

tcmb.tcmb_settings:
  path: '/admin/config/system/tcmb-settings'
  defaults:
    _form: 'Drupal\tcmb\TcmbCurrencySettingsForm'
    _title: 'Tcmb General Settings'
  requirements:
    _permission: 'administer Tcmb'
tcmb.gold_settings:
  path: '/admin/config/system/tcmb-settings/gold-settings'
  defaults:
    _form: 'Drupal\tcmb\TcmbGoldSettingsForm'
  requirements:
    _permission: 'administer Tcmb'
tcmb.other_settings:
  path: '/admin/config/system/tcmb-settings/other-settings'
  defaults:
    _form: 'Drupal\tcmb\TcmbOtherSettingsForm'
  requirements:
    _permission: 'administer Tcmb'
tcmb.other_settings_currency:
  path: '/admin/config/system/tcmb-settings/other-settings/currency'
  defaults:
    _form: 'Drupal\tcmb\TcmbOtherSettingsForm'
  requirements:
    _permission: 'administer Tcmb'
tcmb.other_settings_gold:
  path: '/admin/config/system/tcmb-settings/other-settings/gold'
  defaults:
    _form: 'Drupal\tcmb\TcmbOtherGoldSettingsForm'
  requirements:
    _permission: 'administer Tcmb'

此致 MTO

1 个答案:

答案 0 :(得分:1)

在tcmb.menu_links.yml的第二个块中,父路由有错误:

tcmb.tcmb_settings_currency:
  title: 'Tcmb General Settings'
  description: 'Configure Tcmb module.'
  route_name: tcmb.tcmb_settings
  parent: system_admin_config_system
  weight: 1

父路线应为:

  parent: system.admin_config_system