Drupal 7 在此服务器上找不到请求的URL/drupalhr/drupal/employee/add/
我在drupal中创建了一个带有实体的自定义模块。我已经安装了实体api模块。我通过employee_management.install文件(其中as employee_management是我的自定义模块名)和employee是我的实体名的帮助,创建了只有两列(employee_id,first_name)的数据库模式 我还编写了必需的函数employee_management.module,但它仍然向我显示错误,每当我尝试在admin/structure/employee中添加新实体时,它都会向我显示以下错误:“未找到” 在此服务器上找不到请求的URL drupal/employee/add/Drupal 7 在此服务器上找不到请求的URL/drupalhr/drupal/employee/add/,drupal-7,entity,drupal-modules,drupal-views,Drupal 7,Entity,Drupal Modules,Drupal Views,我在drupal中创建了一个带有实体的自定义模块。我已经安装了实体api模块。我通过employee_management.install文件(其中as employee_management是我的自定义模块名)和employee是我的实体名的帮助,创建了只有两列(employee_id,first_name)的数据库模式 我还编写了必需的函数employee_management.module,但它仍然向我显示错误,每当我尝试在admin/structure/employee中添加新实体时,它
function employee_management_entity_info() {
$employee_info['employee'] = array(
// A human readable label to identify our entity.
'label' => t('Employee Entity'),
// The controller for our Entity - extends the Drupal core controller.
'controller class' => 'EmployeeController',
// The table defined in hook_schema()
'base table' => 'employee',
// Returns the uri elements of an entity
'uri callback' => 'employee',
// Fieldable that we can attach fields to it - the core functionality will
// do the heavy lifting here.
'fieldable' => TRUE,
// The unique key of our base table.
'entity keys' => array(
'id' => 'employee_id',
),
// FALSE disables caching - caching functionality is handled by Drupal core
'static cache' => TRUE,
// Attach bundles - i.e. alternative configurations of fields associated with a main entity.
'bundles' => array(
'employee' => array(
'label' => 'Employee',
// Information below is used by the Field UI - they "attach" themselves here and lets us
// do the standard field management that all the core entities enjoy.
'admin' => array(
'path' => 'admin/structure/employee/add',
'access arguments' => array('administer employee entities'),
),
),
),
// View modes allow entities to be displayed differently based on context. We simply have one option
// here but an alternative would be to have a Full and Teaser mode akin to node.
'view modes' => array(
'full' => array(
'label' => t('Full'),
'custom settings' => FALSE,
),
)
);
return $employee_info;
}
编辑
function employee_uri($employee) {
return array(
'path' => 'employee/' . $employee->employee_id,
);
}
这是文件employee_management.module中功能的完整列表。如果不能自动获得创建实体的路径和表单,则必须自己实现。见和