CVS edit link for WebNewCastle
Hello,My understanding is that we need to obtain a CVS account in order to contribute a module to the Drupal Community.
Initially, I would like to contribute a module that provides simple options for specifying a particular node template to be used on a node-by-node basis (or by content type). This can be done when adding or editing a node by choosing the node template to be used from a list of available node.tpl files in a theme. A default option is also available that would assign the node template to be used from a similar setting in the content types administrative page or or based on default node template suggestions.
My understanding is that there are fewer default options for node template suggestions than page template suggestions, and that node template suggestions are generally limited to content type only. As far as I know from researching contributed modules, I don't believe there is a module that provides a simple solution for overriding a node template on a node-by-node basis.
There are some modules that provide similar options in regards to page templates and block templates. I believe it would also be useful to do this with nodes as well in a number of ways. Although in many cases, one may wish to style and display nodes based on content type, this isn't always the case. And especially where CCK fields can be shared across content types, it would be useful to have additional options to display nodes besides content type. For example, if one wanted to display a particular node with different display settings of CCK fields than the default, one can create a specific node.tpl file to the theme and then choose that template for the particular node.
Please let me know if you have any questions. I've tried to understand this process for using CVS and contributing back to the Community. I've benefited greatly from Community contributions, and I look forward to contributing myself. I also wish to contribute back some themes, but these aren't quite ready for contribution.
Sincerely,
Matt
P.S. I was going to call the module "Node Template", but there is a previous contribution with that name - the functionality and purpose of that module is completely different. I was then going to name it "Node Theme", but that name is used by another contribution which changes the theme for a node (not the template within a theme). The next name I chose is "Custom Node Template", but I am very open to suggestions that will best identify the functionality for the community.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | custom_node_template.tar_.gz | 2.65 KB | WebNewCastle |
| #1 | custom_node_template.tar_.gz | 7.9 KB | WebNewCastle |
Comments
Comment #1
WebNewCastle commentedComment #2
avpadernoComment #3
avpadernoTitle and description should be translatable.
Strings used in user interface should have the first word in capital case, and the other words in lower case (with the exception of proper nouns, adjectives derived from proper nouns, and acronyms).
The code could use
file_scan_directory().Schema description should not be passed to
t(). See system_schema() for an example of what done by Drupal core code.Comment #4
WebNewCastle commentedThank you.
Regarding #1, is the following the applicable information in reference to what you described?
http://drupal.org/node/299085
Comment #5
avpadernot()is mandatory for every string used in the user interface; the only cases where its use is not mandatory for third-party modules code is when the function is called from Drupal core code for those modules (see the case of the menu callbacks title, for which the string is passed tot()from Drupal core code).Comment #6
WebNewCastle commentedThank you. I've made all the changes except for #3 - I am just trying to figure out file_scan_directory.
Comment #7
WebNewCastle commentedI seem to still be having issues linking the results of file_scan_directory back into the rest of the code. Do you have any suggestions for further research on file_scan_directory for how it can be used for this module? Or is #3 not a necessary part for this module? The other items in the list have been completed. I'll add the updated version pending a decision about #3. Thanks!
Comment #8
WebNewCastle commentedComment #9
avpadernofile_scan_directory()returns an array of objects where each object represent a file (the function doesn't return directories).Modules should use Drupal functions, when available.
Just to make an example, this is the result returned by
file_scan_directory(drupal_get_path('theme', 'garland'), '.*\.tpl.php', array('.', '..', 'CVS'), 0, FALSE)(the result has been passed tovar_export()):You could pass a callback name to the function, which would be a function that saves the result in a variable, after it processed the names of the file as your code does.
Comment #10
WebNewCastle commentedThanks. I was able to get it to work to return an array of just node tpl files. It's probably with the callback that I was having issues. Thanks for the example.
Comment #11
avpadernoMy point about using
file_scan_directory()is still valid; the code is still usingsubstr()when it should use the Drupal function.Thank you for your contribution! I am going to update your account.
These are some recommended readings to help with excellent maintainership:
You can find more contributors chatting on the IRC #drupal-contribute channel. So, come hang out and stay involved.
Thank you, also, for your patience with the review process.
Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
I thank all the dedicated reviewers as well.
Comment #12
WebNewCastle commentedHi KiamLaLuno,
Yes, definitely. I got busy with work recently, but I do want to still work towards figuring out what I am missing with the integration of file_scan_directory () into the module code. Thank you for your assistance with questions and in general. I appreciate it. This has been a good experience for me.
- Matt
Comment #15
avpaderno