Hi there,
I am developing small module for term disabling feature (one of my customers asked for it). This is what I have done so far:
There is a new table named taxonomy_term_disabled having two columns - id, tid and it only contains terms which are disabled (so enabling term actually means deleting record from the table, disabling means adding one to it). I also changed the term edit form, so it now contains checkbox for disabling term. So far it was quite easy, but now I need to expose this value to Views. I went through some API documentation and I know roughly which files I have to create but I could not find out where and how exactly shall I put the main "brain" of this feature, the main piece of code which says - when showing terms in Views, provide an information about presence of a row for the particular tid in taxonomy_term_disable table.
Would someone be able to help? Thanks a lot in advance.
Btw.: I am a bit surprised that this feature is not part of Drupal core and as I went through forums I could not find any related topic. Is it just me or is this really that special feature or am I missing something? :-)
Comments
Views
Yeah, getting started with exposing your module data to views is a bit tricky. First thing you need to do is create a file that goes by the naming convention [module_name].views.inc and put that in your module folder. I prefer to put this file in a sub folder called 'views'. Next, implement hook_views_api in your.module file
The modulename.views.inc file just needs one hook to expose the data to views which is hook_views_data(). Something like this should get you started:
This should join your table on the taxonomy id and give you access to the 'id' column. You might also be able to do this:
Where you use a boolean handler instead and treat the id column as a quasi true/false... although I'm not sure if that will work