Allows other modules (such as Taxonomy Redirect) to use hook_entity_info_alter to change the URI callback and thereby modify the links system-wide.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | tagclouds-entity_info-1507716-4.patch | 2.3 KB | Matthew Davidson |
| tagclouds-entity_info.patch | 2.24 KB | Matthew Davidson |
Comments
Comment #1
MGParisi commentedI've looked at this patch and am interested in what you plan to use hook_entity_info_alter for. I want to be careful with this module as it is listed as stable and I don't want people to have to alter their sites for it. But I would like it to use entity's rather then nodes and also to include functionality to plug into the module. I think I would like to see a complete change over to entities instead of nodes for a 2.0 version! I am not (in anyway) dismissing this patch, just wondering if we can do more with it!
Comment #2
Matthew Davidson commentedMy immediate use case is pretty embarrassingly hacky. If a term link is displayed in a view page that accepts terms from that vocabulary as arguments, make the link to this view rather than Taxonomy module's default term page. eg. something like:
While I definitely think a totally-revamped entity-embracing 2.0 is a good idea - tag clouds of Entity references would be awesome - the above patch provides what I think most developers would consider the expected behaviour (i.e. if you change the taxonomy term URI callback it should have an effect on all Drupal-generated taxonomy term links), so it should go in the current stable version as well. If you don't have any modules that change the URI callback for taxonomy terms or nodes in hook_entity_info_alter(), of course this patch has zero practical effect. You can see the default functions taxonomy_term_uri() and node_uri() produce exactly the same paths as your existing code.
Taxonomy Term Reference Tree just committed a similar patch (#1505398: Term URI and load functions used when building field output should come from entity_get_info()), which you can consider support for my claim that the patch is pretty uncontentious.
Comment #3
MGParisi commentedApplied patch and got this error twice:
Notice: Trying to get property of non-object in taxonomy_term_uri() (line 147 of D:\wamp\www\pictures\modules\taxonomy\taxonomy.module).
Comment #4
Matthew Davidson commentedThe only reason I can think of for that behaviour would be if you had been deleted some terms, but there were still nodes that referred to them. If you load the same page without the patch applied do you have one or more links in the cloud that result in "Page not found"?
Don't have time to test it today, but this variation on the patch should eliminate the error messages and just not display links to terms that no longer exist.
Comment #5
MGParisi commentedThe last patch works for me, Ill try to push it to dev for testing
Comment #6
MGParisi commentedIF I did git right, it probably wont list under dev until tonight. Something tells me it wont publish under dev, but it is available under pending patchs.
Comment #7
Matthew Davidson commentedThanks. By the way, I've been working like mad on this one huge project since late last year, and nothing I've done has impressed the client half as much as the ten minutes it took to enable the Tagclouds module and configure a view. My work may not be appreciated, but yours certainly is.
Comment #8
MGParisi commentedCan you test the new patch, before I publish.
Comment #9
Matthew Davidson commentedDone. Working fine as far as I can see.
Comment #10
MGParisi commentedDoes it work with your code, and can we get some documentation on how to use it?
http://drupal.org/node/1317514 Would be the location of where we put tagclouds documentation...
Comment #11
MGParisi commentedCommitted
Comment #12
Matthew Davidson commentedI think the use of hook_entity_info_alter() to modify term links is to general (and advanced) to belong under the TagCloud module documentation. If anything you might just want to mention in passing that TagCloud now works with contrib or custom modules that alter entity URIs. (I just stumbled across Entity Path, which looks pretty cool.)