This module, once the API is stable, will need to have a conditional_text.api.php file documenting the hooks that other modules can use to define plugins. Just filing this issue so it isn't forgotten; obviously it's a little early right now.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | 1191856.patch | 9.23 KB | jhodgdon |
Comments
Comment #1
jhodgdonComment #2
tamasd commentedAdded in 8353f800463b852fc414d96de617f390fd405f12.
Comment #3
jhodgdonThis is an excellent start. I think it needs some work in a few areas.
a)
What are the other components? The only one I see here is the settings form, and the other parts are not explained.
b) Ideally, this file should be displayable using the API module. The part that starts:
will not work for the API module. It just can't handle this type of syntax -- a complex array just stuck into the file. So we need to figure out a different way to put this into the documentation. Usually, what we do is
@code
@endcode
within the @group block, and instead of using /** */ comments inside the plugin example, you would then just use // comments.
c)
This confused me. I think the 'false' => '' should be maybe 'false' => 'false_theme_function_name' or something like that? Then you should make a separate api.php entry for the sample theme function?
I also had the same problem with this one:
d) The word "outputted" does not exist in English. Should just be "output".
e) So... After looking at this api.php file, I am still not sure how you would tell the Conditional Text module that your add-in module has defined a display or condition plugin. Maybe that is because I don't know about CTools, but I think it would be helpful to put something in the introduction about that.
f) I don't think that the part about how th parser parses the condition is necessary for this API file at all. Let's leave that out. What we want to provide is documentation that someone who wants to write a plugin would need.
Comment #4
jhodgdonComment #5
jhodgdonActually, here's an idea.
Pretend you are a module developer coming to Conditional Text for the first time. Ask yourself: What are the steps to create a display plugin? What are the steps to create a condition plugin? And make sure the api.php file answers that question. Maybe instead of listing a sample for each, you could just point to the existing plugins as samples? If they are well-documented, then that would probably be good enough. You could just do something like this (actually, this is a more normal format in Drupal API documentation):
Comment #6
tamasd commentedNew version: 4be1952fde5b1461d83ca95d4c09ffeea6de0832.
Comment #7
jhodgdonThis is really good!
There are a few small grammar errors, and some things that I thought could be clarified a bit...
And one other problem: The API module doesn't recognize comments like:
unless they either contain @file, @defgroup, or come before a function, constant, etc.
So the sections you made:
and the other one for the conditional plugin, would not be displayed at all by the API module. They just need to be combined with the main @defgroup section.
Here's a patch to fix that problem and I think clarify the documentation a bit. Please make sure it's still accurate!
Comment #8
tamasd commentedPushed: 82f1b4a6eb9bc68633eee2af12ace2a06513eec3.
Thanks for the patch!
I did some changes. In D7, every theme function has exactly one argument, called $variables, which holds the variables defined in hook_theme().
Comment #9
jhodgdonLooks good!