- Issue created by @fathima.asmat
- Status changed to Needs review
over 1 year ago 3:12pm 10 March 2023 - 🇳🇱Netherlands johnv
I cannot reproduce the problem.
I guess you have also installed Token module, and some module to add tokens in the view mode, like Automatic Entity Labels?
-
johnv →
committed 94ffa074 on 8.x-1.x authored by
fathima.asmat →
Issue #3347251 by fathima.asmat: Undefined object error from tokens.inc
-
johnv →
committed 94ffa074 on 8.x-1.x authored by
fathima.asmat →
- 🇳🇱Netherlands johnv
Hmm,
I have committed the patch, since it does not hurt.
But there must be something else wrong in your installation. The same code is used in other fields for Token support.
You state it happens with new node, after adding the new field.
Please check if you are not mixing [node:field_language:langcode] and [node:language:langcode] - fathima.asmat London, UK
Thanks @johnv for merging the fix.
I guess you have also installed Token module, and some module to add tokens in the view mode, like Automatic Entity Labels?
I haven't got the token module installed. If this is the case, shouldn't the module to declare the
token
and the other contrib module as dependencies from the info file and install them as well during the module installation?The following bit of code checks the token module service to grab the token type and if not available the module skips from setting up the tokens from the
token_info
hook.$token_type = \Drupal::service('token.entity_mapper')->getTokenTypeForEntityType($entity_type_id); if (empty($token_type)) { continue; }
This seems like
token
is a strict dependency for this module, hence should be defined ininfo.yml
as a dependency, perhaps this needs to be created as a separate issue? - Status changed to Fixed
over 1 year ago 12:51pm 14 March 2023 - 🇳🇱Netherlands johnv
Token module is not required for this module to work properly.
It is/was however my impression that the hook_tokens was only called by the Token module (Which is not, it is a core hook: https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Utility%2... )I still cannot reproduce your problem.
Upon saving and displaying a node, you need some extra step in the test script in order to make it reproducable.
It seems you installation is requesting for delta values that do not exist.
What is the cardinality of your field? Automatically closed - issue fixed for 2 weeks with no activity.