So here's an adventure. This is all just informational. I'm not needing any assistance right now. Bear in mind that I have done no coding so far. Everything I've done has been working through the UI.

There I was, building my content structure using a plethora of node_references, view_fields, and stuff, when suddenly my Automatic Node Titles just stopped working. They were failing to evaluate field tokens, whereas they had previously worked just fine. In the end, I found the problem (sort of), but I have less hair now, if you know what I mean. 

Once I disabled and uninstalled the Basic Entity Plus and the Entity Tokens modules, everything started working again.

I had tried out using custom entities in place of nodes for certain bundles (as discussed in another post of mine), and subsequently abandoned that approach. Along the way, I probably used a number of fields in those entities which I later reused in the nodes that replaced those entities. In the process of troubleshooting I noticed that even after deleting the old entities, there remained a whole bunch of tokens pointing to Basic Entity Plus types—even though none of those entities still existed. 

So my experience leaves me with some questions...

  1. In the case of both nodes and Basic Entity Types, when you delete the type, a) are the associated db tables dropped? And b) are the associated tokens destroyed?
  2. Is it likely that creating an entity and a node with the same name (if that's possible) can cause "token confusion"? I may have done that.
  3. Does the Entity Token module have an issue that anyone else has experienced? 

Comments

Hi Eric. I can answer some of your questions. I recently started maintaining Entity Tokens (I haven't yet done any releases, since I'm cleaning up several issues), AND I'm also the maintainer / author for Basic Entity Plus Example.

First of all, Basic Entity Plus Example is not intended to be used in  "production". It's a module that provides an example of a custom entity and entity type so that you can develop your own modules that define entities. As such, it's not recommended that you keep it installed beyond the learning period.

I have checked the module, and yes, when uninstalling there are a few things that remain. In theory, uninstalling it will remove the tables where the custom entities are stored - that seems to work fine. Please note: be sure you go to admin/modules/uninstall to actually uninstall it. It's not enough to disable it. However, there are cases when some configurations are left in the site, for example, the View that the module creates to display the custom entities, and the configurations for any Field API fields you added to your custom entities. I will be revising the module to be sure the View is removed in the future (right now the easiest way to remove that view is to go to the Views UI, find it and delete it). Feel free to add to the issue queue of Basic Entity Plus Example and let me know of issues with that example module. There are still some bugs in it - any report you can provide will help me clean the module up.

Regarding Entity Tokens: that module was ported a long time ago and left there without much maintenance. It's important to understand that tokens (both those in core, and those created by Entity Tokens) Do not exist in the database or in the configuration folder. They are created "on the fly" with every page request. The only thing that remains in database is a cache of the token definitions, which is cleared and rebuilt every time you clear your cache. So, if you have really uninstalled Entity Tokens and cleared your caches, all the tokens defined by Entity Tokens will disappear.

And one more "however": please notice that the tokens defined by Backdrop's core do include field tokens. This means that, if you added fields to your custom entities created through Basic Entity Plus Example, definitions for those tokens will be created and stored in the cache. When you uninstall Basic Entity Plus Example, it's probable that the fields that were attached to those entities may remain in the database for some reason (e.g. they are used by other entities) and/or in the config files. This means that you may still see tokens for those fields. Those tokens are defined by the core field.tokens.inc. 

I will do some testing later to see why fields of removed entities are not removed. In the meantime, the best way to get help regarding specific bugs of contrib modules is to create issues in those modules. If you could provide a detailed description of the issue there, that'd be great!  

Thanks 

  

First of all, Basic Entity Plus Example is not intended to be used in  "production".

—Yes, I fully understand that to be the case, which is why I am posting this "for conversational purposes," as a means for me to learn more about Backdrop's architecture and inner workings.

So, if you have really uninstalled Entity Tokens and cleared your caches, all the tokens defined by Entity Tokens will disappear.

—Yes. This was my experience.

I will do some testing later to see why fields of removed entities are not removed.

Just to be clear, I don't know for sure if this actually happened.

This also brings up another series of questions I have regarding the "life" of a field. I will open a new topic for that one...

Thanks for your help and encouragement.

Just to follow up...

I did some testing, and I must have slipped a cog in thinking that "orphan fields" remained. When I create a new field, then use it, then delete it, it is apparently destroyed, unless I attached it to more than one bundle. Otherwise, it disappears from the "add existing field" dropdown.

This seems to me to be good behavior. Sorry for my errant comment on this.