Closed (won't fix)
Project:
XML sitemap
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
17 May 2009 at 04:05 UTC
Updated:
13 Jul 2009 at 23:06 UTC
Jump to comment: Most recent
Comments
Comment #1
avpadernoThere is actually a module that integrates with XML sitemap, which could take vantage of this function: Gallery.
Comment #2
avpadernoThere is a little grammar error in the title; or better, there was.
Comment #3
dave reidThis should actually be hook_xmlsitemap_api and therefore xmlsitemap_xmlsitemap_api() to prevent name collision. If we're going to do this, we should take it a step further and actually check the api version from modules when getting the sitemap links instead of just adding one simple hook.
Comment #4
dave reidFor example, instead of doing something like this:
We need to do this:
Is this really a necessary step for us to take? We're not as big and integrated with everything like Views, so why can't we just work with the module maintainers to update their implementations? Please validate.
Comment #5
dave reidThe API number should also be a number value and not a string so that we can compare 1 < 2 or 1.5 < 2, etc.
Comment #6
avpadernoIt could be also a string, and passed to
version_compare().Comment #7
avpadernoI was thiking to something that would help a third-party modules to understand if the version of XML sitemap installed is the one they support; that is why I proposed a simple function.
The maintainers can change their code, but they cannot control the version of XML sitemap installed.
Comment #8
dave reidThe views API uses numbers, so that's the example I'm using.
See http://drupal.org/node/418750 and http://api.lullabot.com/hook_views_api
The way I think this should be implemented is the way Views does it where the xmlsitemap module would check the xmlsitemap_api versions of all the implementing modules like I have shown in #4. Otherwise I don't think this is useful to other module maintainers at all.
Comment #9
avpadernoThat is fine, for me. I just didn't want to give the impression of suggesting something too complicated, but something simple that works on the case of XML sitemap, which (as you remembered) doesn't need all the complexity of Views. My comparison with Views was because it's a well known example of a module that checks the other modules for the compatibility they have with it.
Comment #10
dave reidYeah, agreed. I'm just still not sure what the usefulness of the function is and how it can force other module developers to work with the proper APIs. Plus, this function has been removed from the 6.x-1.x branch.
Comment #11
avpadernoI removed it until we don't agree on something.
My idea was that third-party modules should verify the value returned from the function. The problem is how to use the function, which would not avoid a custom hook is invoked when it is not the right hook for the currently installed version of XML sitemap.
I can think of just an alternative for this problem.
Comment #12
avpadernoThe only alternative I can think of is that the code verify if the modules implement two different custom hooks.
I explain myself better; rather than calling all the implementations of
hook_xmlsitemap_links(), which is the cause of not compatibility, the code should call the implementation ofhook_xmlsitemap_links()for all the modules that implement alsohook_xmlsitemap_xyz().hook_xmlsitemap_xyz()should be a custom hook that is already used, but it's only required for a specific version, or a custom hook that the particular branch will ask to third-party modules to implement for compatibility.In the later case, the custom hook must not do anything, nor return anything; it should be just a place holder that the code will check for, without to using any value returned by the custom hook.
This solution should at least avoid that a third-party thought to be used from a particular XML sitemap branch will be used from a different branch.
Comment #13
avpadernoI looked at Chaos Tools, and it implements a function that returns the actual API version implemented by the module.
The comment placed in the module clearly states:
EDIT: the author of that module is the same who created Views.
Comment #14
dave reidI'm still not sold on this at all. :/
Comment #15
Anonymous (not verified) commentedI think it's unneeded fluff that someone maybe will use. We can always add it if some module maintainer using the xmlsitemap API wants it. I just don't see that need.
Comment #16
avpadernoIt would be unneeded fluff if you would be able to force any people to use the same branch of the project; differently, third-party modules would have to deal with the current branch installed from the users. As already there is a case, that is not an abstract consideration.
I don't understand what the concept of implementing something only if required is; does that mean a bug is fixed only if somebody opens a bug report?
Comment #17
dave reidWon't fixing this issue for now. We can revisit this if we have lots of modules that implement the APIs, which is not the case right now.