New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
uri callback
needs complete removal or documentation
#5641
Comments
The File entity lags behind in many ways. The The callback only makes sense if an instance exists, as it currently returns |
This has to do with the ways tokens are defined and fulfilled. They are completely separate processes. It's ancient code that really needs updating:
So, to your question: Without the availability of So, without [EDIT: corrected many typos - gosh my brain is still asleep] |
I see... sort of. 🤔 system_token_info() doesn't define any uri tokens, though.
I suspect, you're not actually talking about the tokens defined by core (system), but about tokens via module entity_tokens. Is that correct? |
I was referring to core tokens, but I typed the wrong function in my last response to you - I meant |
Sorry, yes, it's in the "alter" hook. Following your explanation this all makes sense, but could you also provide an actual situation, where this either breaks functionality or causes problems? Not sure yet about the best approach (remove / restore...). |
In #164, callback definitions were removed from
hook_entity_info()
in favor of adding methods to entity classes. This includeduri callback
, a legacy from D7 that was used by the entity controller to build the url. Entities now are supposed to overrideEntity::uri()
instead.The problem is that
uri callback
is still being used inentity.tokens.inc
-entity_token_info_alter()
checks if uri callback exists when deciding if the 'url' token should be defined for the entity type. (As a side note: the token fulfillment function usesEntity::uri()
rather than the uri callback to look up the entity uri).The only core entity still providing a uri callback is
file
.We should either remove these last uses of
uri callback
or document it properly inentity.api.php
.Removal presents a problem as
uri callback
is still a useful way to know if the entity "wants" a uri token to be defined: when you are defining tokens, you don't have an entity against which to check if the uri method returns a valid uri. We could either create a dummy entity (ugly solution, but done with create access for some entities), or provide uri tokens for ALL entities, but this is problematic if entities do not want to support a uri for viewing or editing (there are examples of this in Ubercart and OG). In those cases, you don't want the site builder to see url tokens for those entities.The text was updated successfully, but these errors were encountered: