Description
The Alternate Label module allows you to add an alternate label to your cck fields while viewing the node.
This module displays the default label while creating a content and a different label while displaying them. The purpose is to make forms more interactive. This module depends on CCK module.
Use case
You have a dropdown field with label "You are :" and options are "Scientist, Doctor, Engineer" but while you display in the node you should not display it as "You are: Student" instead display it as "Customer is: Engineer" or "Qualification: Engineer"
There are no projects currently that provide such facility.
This module is for Drupal 6.
Link
Alternate Label
GIT
git clone http://git.drupal.org/sandbox/mantish/1655164.git alternate_label
Other Projects Reviewed
http://drupal.org/node/1674998#comment-6208722
http://drupal.org/node/1596172#comment-6206516
http://drupal.org/node/1668528#comment-6197530
http://drupal.org/node/1615222#comment-6242034
http://drupal.org/node/1686696#comment-6237938
http://drupal.org/node/1677904#comment-6231786
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | drupalcs-result.txt | 1.44 KB | klausi |
Comments
Comment #1
Timusan commentedHey Mantish
Nice idea, I could think of some use-cases for this myself!
I found some general issues with your code regarding Drupal's coding standards and GIT standards:
function my_module_hook() {Note the space between the () and the {
You can always use the automated project reviewer to check your syntax.
I made a check for your project, you can review it here: http://ventral.org/pareview/httpgitdrupalorgsandboxmantish1655164git
Comment #2
mantish commentedHey Timusan,
Since this was my first project i had absolutely no idea of drupal standards thanks a lot for pointing out those issues.
I have fixed all the errors.
Comment #3
mantish commentedComment #4
Timusan commentedHey Mantish
No problem, we are all here to learn and contribute to the community. I'm also fairly new to coding to Drupal, and also had to review my code the first time to fit the Drupal standards.
I reviewed the code again on standards and found only a few small issues:
Regarding your code I have one general comment about your syntax of db_query. Would it not be better to not try escaping the single quotes, but rather use the printf() notation? For example line 51 of your module file reads:
db_query('update {alternate_label} set alternate_text = \'' . $alternate_text . '\', status = \'1\' where field_name = \'' . $field_name . '\'');This can be rewritten as
db_query("update {alternate_label} set alternate_text = %s, status = %b where field_name = %s", $alternate_text, 1, $field_name);I did a test on a clean Drupal 6 installation running PostgreSQL and the module seems to work perfectly.
I can enable Alternate Label on a text field and it displays when viewing the node, but shows the normal label when editing.
Maybe it is also a good to work this inside the display modes of the node...so the user can choose on which type of display (full, teaser, rss, ...) the label is visible and on which type it is not? Maybe also allow for multiple labels for multiple types of display modes? Just an idea :)
Cheers
T
Comment #5
Timusan commentedComment #6
mantish commentedHey Timusan,
Thanks again for taking time and reviewing my code and pointing out those issues.
I have changed the content of README.txt in master branch.
Now, there is a new line between the end of a function and the beginning of the next one, or the beginning of the next block of comment.
The queries are now changed to use %modifiers.
Thanks for the suggestion regarding changing the display modes of the node. I may require more time for that.
Thanks
Mantish
Comment #7
Timusan commentedHey Mantish
Good work, I can confirm that you updated the above issues.
I tested the module again and everything seems to work the same.
One very tiny detail: In your .install file, on line 19 you say it is an implementation of hook_uninstall, but the function below is actually hook_schema. And also try to be consistent in your comments, try always to write hook() instead of HOOK().
Thats it actually...if you update that, I think I can RTBC it!
I totally understand that the above feature requests will take more time. Maybe views integration is also another nice feature, that you can choose which of the alternate labels you want to show in the view...but I'll stop making feature requests now , lets do that once your module is fully accepted :)
Cheers
T
Comment #8
mantish commentedHi Timusan,
Thanks again for the review.
I have changed the comment in .install file.
The other comment in .module file was actually to differentiate between the first hook and the second hook in the same function name. The first one was to represent module name and the second one was to represent "content_field". The link is here - http://api.drupal.org/api/drupal/developer!hooks!core.php/function/hook_.... Anyway i have changed it to hook_preprocess_hook.
Sure, we will get started with new features once fully accepted. :-)
Cheers
Mantish
Comment #9
Timusan commentedHey Mantish!
Ok, I can confirm that the changes are made...looks good to me!
Cheers
T
Comment #10
klausiWe are currently quite busy with all the project applications and I can only review/approve projects with a review bonus. Please help me reviewing and I'll take a look at your project right away :-)
Comment #11
mantish commentedHi Klausi,
As you mentioned i have reviewed 3 projects and added the link to the Issue Summary as mentioned. I am also tagging this comment with "PAReview: review bonus".
Regards
M
Comment #12
klausiThere is still a master branch, make sure to remove it. See also step 6 and 7 in http://drupal.org/node/1127732
Review of the 6.x-1.x branch:
This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.
manual review:
Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.
Comment #13
mantish commentedHi Klausi,
Thanks for reviewing my code and pointing out those security and indentation issues.
I have resolved all of them except the master branch, in master branch i have kept only a README.txt as mentioned by Timusan earlier.
Regards
M
Comment #14
mantish commentedHi Klausi,
I removed the master branch as well.
Regards
M
Comment #15
Timusan commentedHey Mantish / Klausi
In my understanding it was optional to delete the master branch as described in step 7 of the tutorial.
If this was misleading information, I apologize Mantish.
Good luck with the module!
Cheers
T
Comment #15.0
Timusan commentedAdded the Other projects reviewed.
Comment #16
mantish commentedHi Klausi,
Adding PAReview: review bonus tag. Updated the links for comments in the issue summary.
Thanks
M
Comment #17
misc commentedOn really minor thing:
* In the .install:
drupal_set_message($t('Installing Alternate Label module'))- there is an extra space between Label and moduleThis is RTBC for me.
Comment #18
mantish commentedHey MiSc,
Thanks for the review. I have fixed that.
Regards
M
Comment #19
patrickd commentedsidenote: if your code is looking shitty because your trying to keep the line smaller then 80 cols - then f*** of that automated reports. (to clarify the 80 cols limit is actually ONLY for comments)
Thanks for your contribution and welcome to the community of project contributors on drupal.org!
I've granted you the git vetted user role which will let you promote this to a full project and also create new projects as either sandbox or "full" projects depending on which you feel is best.
Thanks, 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.
As you continue to work on your module, keep in mind: Commit messages - providing history and credit and Release naming conventions.
Thanks to the dedicated reviewer(s) as well.
Comment #20.0
(not verified) commentedAdded 3 reviewed project links.