1

I have altered the CRUD paths for entity types and bundles created with Entity Construction Kit. The change propogates correctly, all views which use the ECK provided views fields (Link, Edit, Delete) are now using the correct URL.

The issue is when trying to hit those URL's, the page is always access denied. What I have found in my troubleshooting:

  1. The menu is built within eck.entity.inc. I have used the following test code, inserted at line #93

    if ($bundle->name == 'inventory_item' && $action_label == 'Edit') {
      print_r($access_args);
      die();
    }
    // result = Array ( [0] => edit [1] => inventory_item [2] => inventory_item [3] => 5 )
    

    Note that the $access_args does contain the correct entity id (index 3 in the result array).

  2. The menu access callback is eck__entity_menu_access() which is found in eck.module and I have included the following there, inserted at line 762:

    if ($action == 'edit' && $bundle_name == 'inventory_item') {
      print_r(func_get_args());die();
    }
    // result = Array ( [0] => edit [1] => inventory_item [2] => inventory_item [3] => )
    

    Note that index 3 ($entity_id) is null now.

I can't figure out where the entity id is lost. I don't think it matters, but I did check the loader, eckentity_load() and it is loading the correct entity.

Any ideas why the entity id is not making it to the access callback?

0

It would be helpful to see an example of an original ECK path (for a single entity), and then your updated one. If you re-arranged the arguments, or changed their quantity, the access arguments passed to the access callback will not be correct.

You will almost certainly need to implement hook_menu_alter to update the access arguments property of ECK paths.

  • Thanks Yuriy, you forced me to re-think my assumptions. I was convinced I was getting what I needed because the $access_arguments[3] happened to be the entity id of the item I was testing -- everything I know about access arguments being a position in the path was lost :) It might be prudent to add that one also needs to update the page arguments property. – Chris Rockwell Jun 17 '16 at 22:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.