Say one is writing a custom CCK field whose purpose is to be the recipient of the FeedAPI mapper ...

The general case is for any 3rd party to define a mapper w/o having to get the mapper adopted by the FeedAPI Mapper project.

It is hard to hook in the mapper if the mapper has to be in feedapi_mapper/mappers ... but in _feedapi_mapper_load_mappers that is unfortunately the requirement.

How?

I think a new table, feedapi_mappers .. it would list the file names to be loaded in _feedapi_mapper_load_mappers and (maybe) the module which it is associated with.

The feedapi_mapper module would export two methods: feedapi_mapper_add_mapper, feedapi_mapper_delete_mapper

Any module wishing to register mappers would call those functions in its .install file.

Comments

aron novak’s picture

You can implement a mapper in any enabled modules. So the mapper would not be an .inc file, but only a function inside the .module file. This mapper is only an implementation of hook_feedapi_mapper(), just like any other hook.
The feedapi_mapper/mappers directory is special, but this has no exclusive role in this game.

alex_b’s picture

Status: Active » Closed (fixed)

As Aron said, hook_feedapi_mapper() is as much a hook as say, hook_nodeapi() - you can implement them wherever it seems convenient to you.

The only requirement is the format [module_name]_feedapi_mapper() and that it is included at the time feedapi_mapper invokes the hook (that's e. g. the case if you define the mapper in a .module file).

reikiman’s picture

Thank you I eventually figured that out.