在第46行的\ sites \ all \ modules \ community \ entityreference \ entityreference.install中调用未定义的函数entityreference_get_behavior_handlers()

时间:2015-05-12 12:12:33

标签: php mysql drupal-7

我是drupal的新手,在这里我有一个项目可以工作。因为我得到一个错误。

  

致命错误:调用未定义的函数   entityreference_get_behavior_handlers()in   \网站\所有\模块\社区\的EntityReference \ entityreference.install   第46行

我检查了那个文件。

foreach (entityreference_get_behavior_handlers($field) as $handler) {
      $handler->schema_alter($schema, $field);
}

这些是行,尤其是错误来自以下函数调用。

entityreference_get_behavior_handlers($field)

我也尝试过调试。这是我打印变量时产生的结果。

print_r($field);

Array
(
    [translatable] => 0
    [entity_types] => Array
        (
        )

    [settings] => Array
        (
            [target_type] => user
            [handler] => base
            [handler_settings] => Array
                (
                    [target_bundles] => Array
                        (
                        )

                    [sort] => Array
                        (
                            [type] => none
                        )

                    [referenceable_roles] => Array
                        (
                            [5] => 5
                            [2] => 0
                            [3] => 0
                            [4] => 0
                            [6] => 0
                            [7] => 0
                            [8] => 0
                            [9] => 0
                            [10] => 0
                        )

                    [referenceable_status] => Array
                        (
                            [active] => active
                            [blocked] => 0
                        )

                    [behaviors] => Array
                        (
                            [views-select-list] => Array
                                (
                                    [status] => 0
                                )

                        )

                )

        )

    [storage] => Array
        (
            [type] => field_sql_storage
            [settings] => Array
                (
                )

            [module] => field_sql_storage
            [active] => 1
            [details] => Array
                (
                    [sql] => Array
                        (
                            [FIELD_LOAD_CURRENT] => Array
                                (
                                    [field_data_field_web_designer] => Array
                                        (
                                            [target_id] => field_web_designer_target_id
                                        )

                                )

                            [FIELD_LOAD_REVISION] => Array
                                (
                                    [field_revision_field_web_designer] => Array
                                        (
                                            [target_id] => field_web_designer_target_id
                                        )

                                )

                        )

                )

        )

    [foreign keys] => Array
        (
            [node] => Array
                (
                    [table] => node
                    [columns] => Array
                        (
                            [target_id] => nid
                        )

                )

        )

    [indexes] => Array
        (
            [target_id] => Array
                (
                    [0] => target_id
                )

        )

    [id] => 14
    [field_permissions] => Array
        (
            [type] => 0
        )

    [field_name] => field_web_designer
    [type] => entityreference
    [module] => entityreference
    [active] => 0
    [locked] => 0
    [cardinality] => -1
    [deleted] => 0
)

我相信这将是更详细的帮助我。

提前致谢,

的Vivek

1 个答案:

答案 0 :(得分:0)

我得到了解决方案。

添加以下行。

// Invoke the behaviors to allow them to change the schema.
module_load_include('module', 'entityreference');

上面

foreach (entityreference_get_behavior_handlers($field) as $handler) {
    $handler->schema_alter($schema, $field);
}
文件\sites\all\modules\community\entityreference\entityreference.module

中的

谢谢&的问候,

<强>的Vivek