Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/powerbi/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Drupal 7 有没有办法在druapl 7中定义一个以通配符开头的新路由_Drupal 7_Drupal Modules - Fatal编程技术网

Drupal 7 有没有办法在druapl 7中定义一个以通配符开头的新路由

Drupal 7 有没有办法在druapl 7中定义一个以通配符开头的新路由,drupal-7,drupal-modules,Drupal 7,Drupal Modules,我实现了一个hook_菜单,我想定义这样一个路由 $item['%'] = array(); 当用户输入类似于这个域/whater的url时,单词whater必须作为参数传递给页面回调函数。任何人都可以帮助我。在Drupal中没有完全动态的路由,大多数模块(包括内容上的核心循环)都无法创建此类路由 foreach (entity_get_info() as $entity_type => $entity_info) { foreach ($entity_info['bundles

我实现了一个hook_菜单,我想定义这样一个路由

$item['%'] = array();

当用户输入类似于这个域/whater的url时,单词whater必须作为参数传递给页面回调函数。任何人都可以帮助我。

在Drupal中没有完全动态的路由,大多数模块(包括内容上的核心循环)都无法创建此类路由

foreach (entity_get_info() as $entity_type => $entity_info) {
    foreach ($entity_info['bundles'] as $bundle_name => $bundle_info) {
        $path = $bundle_info['admin']['path'];
        $items["$path/fields"] = array(
            'title' => 'Manage fields',
            'page callback' => 'drupal_get_form',
            'page arguments' => array('field_ui_field_overview_form', $entity_type, $bundle_arg),
            'type' => MENU_LOCAL_TASK,
            'weight' => 1,
            'file' => 'field_ui.admin.inc',
        );
    }
}

例如

为什么需要这样做?@我想让一些页面的路径根据其类型进行更改。例如,如果我写uuu域uuu/**car**它必须给我汽车作为车辆类型,如果我写uuu域uuu/**motor**它必须给我汽车作为车辆类型。因此我可以使用这些类型并显示用户正确的数据。如果你想根据你的内容类型更改你的路径,你应该检查Pathauto模块。