Referencing parent entity I've just started with Drupal and I'm trying to create the following URL structure with PathAuto and Entity Reference:

Category A -> Category B -> Category C

Resulting in

category_a/category_b/category_c

For display purposes, I have to define the entity reference on the parent entity. IE:

On Category A, define an entity reference to nodes of Category B.

However, in PathAuto it appears that I can only reference child entities, not parent entities.

I have referenced this article (Path alias tokens and node references) which describes the solution if the entity reference is defined on the child, not the parent.

Is there any way to achieve the above?


Entity Reference 7.x-1.1  
PathAuto 7.x-1.2  
Entity Tokens 7.x-1.5
I came across this post when facing the same situation so I am posting the solution I found in case someone else needs it.

The only way I found to solve this was declaring a custom token using hooks. This post was really helpful: https://drupal.stackexchange.com/a/78498

Once both hooks are implemented, you will only need to manually load the parent to get the data you need, whether it is the parent URL or the parent title. After that, just use the token you just created and voilá!

Hope it helps!