Module builder has got to the stage where I think it's ready for other contrib modules to add support for it, allowing developers to quickly set up code for hook implementations.
In order to add support for module builder, views would need to do the following:
1. Add a views.module_builder.inc file. I've attached this :) This implements hook_module_builder_info (details here: #406538: Module Builder Hook)
2. restructure the files in /docs. Each potential destination for hook code should get a file. So since views hooks can go into the module file, a views.inc, or a views.defaults.inc, that's three files. The views.module_builder.inc file will then need tweaking to list these.
3. It would be nice if the opening description of each hook were a single line :)
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | 557160.views_.move-hook-docs-to-standard.patch | 41.79 KB | joachim |
| #1 | views.module_builder.inc_.txt | 798 bytes | joachim |
Comments
Comment #1
joachim commentedComment #2
dawehnerAs far as i understand Earl, views does only integration into drupal core.
For example see http://drupal.org/node/508550#comment-1769594
But I really like it, i just needed it on the train.
Comment #3
joachim commentedUm, no, this isn't about Views support, it's about module builder support.
Or to put it another way:
"support for views" = views having information about a module's database tables.
"support for MB" = MB having information about a module's hooks.
Maybe I've got my terms the wrong way round? but anwyay, the former is irrelevant here; this issue is about the latter.
Just as views only supports core, so does MB only support core.
I chatted briefly to merlinofchaos about this online and he was open to the idea :)
Comment #4
dawehnerDid you have uploaded the views hooks? Last time i drush mbdl -ed they got downloaded, too :)
Comment #5
joachim commentedYeah -- I figured rather than wait for modules to support this, I'll just shove in the data into MB for now.
Comment #6
Letharion commented@merlinofchaos
If you think Views should support this, I could take on this.
Assign to me if yes, or comment/close if no.
Comment #7
joachim commentedI've kind of given up on this myself ;)
The support for Views 6--2 with module builder is currently in the code for MB.
What would be good to check is that Views has the standard api.php file to document hooks on Drupal 7. IIRC it doesn't follow the same filename convention as core.
Comment #8
dawehnerIt's currently docs/docs.php and not views.api.php
Comment #9
joachim commentedThought as much.
In D7 core, the standard is node.api.php. So on Views this should be views.api.php.
This would be good to change not just for module builder, but various API sites too.
Comment #10
merlinofchaos commentedThis one never got onto my radar due to the generally large amount of traffic in the queue. Sorry about that, joachim.
I am not opposed to adding the module_builder.inc file to Views, but it isn't looking like that's really necessary at this time since module builder already has it, and moving it seems like more work than actually benefits anyone.
Anyone want to do the required patch for D7?
Comment #11
joachim commentedAgreed; the best thing to do here is just move docs/docs.php to views.api.php for D7. Shall we retitle this issue or make a new one?
Comment #12
dawehner@joachim
This would fix everything, right?
Comment #13
joachim commentedYup.
Module builder on D7 already goes looking for MODULE.api.php in module base folders because that's what core does, so it should find views.api.php too.
...
In fact, MB does:
Though I may change that to use module_list() as the above code then needs a load of mucking about with regexps to actually find module names.
Comment #14
joachim commentedHere's a patch to move the file to views.api.php.
I've put it in the base folder as that's where all core modules put theirs.
Comment #15
dawehnerLet's stick with the standards. Commited and pushed.
Comment #16
merlinofchaos commentedNo, not in the base folder, please. Core loves to litter the base module folder, and it's terrible. Look in system module.
Comment #17
merlinofchaos commentedI just moved it back to the docs folder and pushed.
Comment #18
joachim commentedHmm... would be better to fix the standards rather than diverge from them.
(Though I say this; module builder still outputs 'Implementation of...')
Comment #19
merlinofchaos commentedWell, re-organizing core would be nice, but is hardly a priority.
views does a lot of things core doesn't do, so sometimes Views uses different standards. One of my standards is "Keep the root directory clean." Core puts .css files in the module root directory. I don't. Nobody has complained about this, either. :)
Comment #20
merlinofchaos commentedAlso, just because core chose to put its files someplace doesn't really mean it's a standard. That's just the choice core developers made when they did the patch. We must differentiate from "Core does it that way" from "it's a standard" and the latter implies some serious thought about why it's done that way. THe former merely implies that's what they chose at that moment.