Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
While impractical; occasionally it can be helpful to use Webform submissions as nodes. The simple idea being Webform keys become fields and their associated values become those of the node field.
This technique can be used to compare data via views rather than using a Webform value reference.
- Allows the administrator to set a content type to receive submission data
- Allows setting of Webform(s) to submit data
- Checks for existing fields, if found in another bundle; creates new instance
Drupal 7.x module.
Project page
http://drupalcode.org/sandbox/MrAsia/1696484.git
Comment | File | Size | Author |
---|---|---|---|
#21 | coder-result.txt | 1.02 KB | klausi |
Comments
Comment #1
thedavidmeister CreditAttribution: thedavidmeister commentedFirst thing to do would be to use the automated code review at ventral.org
http://ventral.org/pareview/httpgitdrupalorgsandboxmrasia1696484git
You can see that there's some minor whitespace/coding standard issues in your sandbox.
The other problem is that you're supposed to use a branch called 7.x-1.x instead of "master", even if your module is only for D7 at the moment.
http://drupal.org/node/1127732
Then work through the checklist here - http://ventral.org/pachecklist
Comment #2
patrickd CreditAttribution: patrickd commentedAs installation and usage instructions are quite important for us to review, please take a moment to make your project page follow the tips for a great project page. Also create a README.txt that follows the guidelines for in-project documentation.
An automated review of your project has found some issues with your code; As coding standards make sure projects are coded in a consistent style we please you to have a look at the report and try to fix them. Anyway, note that issues found are possibly false positives and fixing all issues is not a requirement for getting through the application process.
enough major issues for needs work.
Comment #3
thedavidmeister CreditAttribution: thedavidmeister commentedHere's my thoughts on the code (ignoring that the comments are all in a weird format, see the automated review in my last comment)
- Maybe you should add the webform module as a dependency. It seems harmless enough with webform disabled but why not make sure the module gets cleaned up when webform gets disabled?
- Currently you don't have an .install file, and so you aren't cleaning out your variables from the database on uninstall. You can just use variable_del() once for each of your variables in hook_uninstall().
- There's a spelling mistake in one of your variables 'webform_node_insert_contet_type', you mean "content_type" right?
- Use full stops at the end of your descriptions on the admin form, ie. "Content type to store Webform submissions."
- You really need a README.txt file. It can be the same as the description on your sandbox page.
Comment #4
swim CreditAttribution: swim commentedThanks dave & patrickd.
Updated as per the requests made in #2 & #3. Formatted code as per the http://ventral.org checklist.
http://ventral.org/pareview/httpgitdrupalorgsandboxmrasia1696484git
Comment #5
Primsi CreditAttribution: Primsi commentedHi, this looks like an interesting module.
Comment #6
Primsi CreditAttribution: Primsi commentedDoh... I keep forgetting to change the status. Sorry.
Comment #7
swim CreditAttribution: swim commentedThanks Primsi,
Just to clarify; the title check was implemented because of a production site unable to load the associated node title. I'm still lost as to why this was the case and am hoping it was a once off. The site in question has a large amount of custom code which could easily be interfering with other module operations.
Recently havn't had time to catch my breath but am working towards a review bonus;
1
Comment #8
dwieeb CreditAttribution: dwieeb commentedHi,
user_access
, notnode_access
for your access callback. I got PHP errors immediately upon enabling your module and wasn't even able to view the admin page for your module.Comment #9
swim CreditAttribution: swim commentedSorry, was away for just over a month.
I'll aim to improve the admin interface as it only serves a basic use case currently. There should not be any PHP errors; regardless of field type or if the field exists within the targeted content type.
Thanks,
Comment #10
D2ev CreditAttribution: D2ev commentedhi... This module work fine with webform module and it successfully creating the nodes. Not major issues but you need to check it.
1.
try to avoid error when no webform exist so define empty array for
$node_names = array();
2. you can optimize
webform_node_insert_field_data($fields)
as the $instance variable is defined twice.3. When i edit a webform submission it is not reflected in the node content and can you make it working, if i edit a webform submission also it will create nodes if not exist. I need to implement it in sites where i already had submissions.
Comment #11
Devin Carlson CreditAttribution: Devin Carlson commentedNeeds work based on #10.
Comment #12
wachyudisonang CreditAttribution: wachyudisonang commentedthanks for the great module.
i have success implement for creating field into content type with your module.
but i had a problem when inserting ‘term reference’ field select option by implementing hook_webform_select_options_info.
if i choose taxonomy in select option webform field, then your module always create ‘text’ field into content type.
how can i get ‘term reference’ field in my content type?
Comment #13
swim CreditAttribution: swim commentedThanks #10 & #12.
@D2ev While it was never intended to perform the functionality you describe in point 3 I now realize this is fairly naff without it... Importing previous Webform submissions is rather useful.
Regarding point 2, $instance is defined twice because the array holds different data, this will be optimized however as your correct his could be cleaned up.
Because of the issue raised by D2ev regarding the importing of previously submitted Webform results I'll rewrite that part of the module to accommodate the request.
@abissbo I'll add support for mapping fields eventually.
Thanks,
Comment #14
swim CreditAttribution: swim commented1
2
3
PAReview: review bonus tag
Comment #15
swim CreditAttribution: swim commentedArgh, forgot to change status.
Added new feature for importing previous submitted Webform results.
Comment #16
esbenvb CreditAttribution: esbenvb commentedIn your webform_node_insert_form_submission_import() you use $node->language to select the language code of the fields.
This will not always work, since node language and field language might often be different (for example when using term references).
The proper way is to use the function field_language() to get the language for the field instance or use and entity_metadata_wrapper() to handle it.
Also, it still doesn't comply with all coding standards:
FILE: ...les/pareview_temp/test_candidate/includes/webform_node_insert.admin.inc
--------------------------------------------------------------------------------
FOUND 2 ERROR(S) AFFECTING 1 LINE(S)
--------------------------------------------------------------------------------
92 | ERROR | Whitespace found at end of line
92 | ERROR | Function comment short description must be on a single line
--------------------------------------------------------------------------------
FILE: ...tes/all/modules/pareview_temp/test_candidate/webform_node_insert.module
--------------------------------------------------------------------------------
FOUND 3 ERROR(S) AFFECTING 3 LINE(S)
--------------------------------------------------------------------------------
137 | ERROR | Parameter comment indentation must be 2 additional spaces at
| | position 1
138 | ERROR | Whitespace found at end of line
140 | ERROR | Parameter comment indentation must be 2 additional spaces at
| | position 2
--------------------------------------------------------------------------------
The problem at line 137 and 140 is that you have an extra space in the indentiation. The paramter descriptions should be indented two spaces more than the line above.
Comment #17
esbenvb CreditAttribution: esbenvb commentedComment #18
swim CreditAttribution: swim commented@16
$node->language = LANGUAGE_NONE is used, this will always work while not allowing support for any specific language. Because we are creating the fields and not migrating them from another node a transmutable check is not performed. Allowing the administrator choice of node status and language can easily be added later.
I don't believe the automated review of purely formatting is enough to mark this as 'needs work'. I'm currently overseas but will address the formatting asap.
Cheers,
Comment #19
thedavidmeister CreditAttribution: thedavidmeister commentedThe extra language support does seem like a feature request rather than a definite release blocking bug... esbenvb should probs open a ticket in the issue queue on the project so it isn't forgotten and can be included later.
While you're right that minor issues on Ventral shouldn't block an application from being approved, the D.O. standards *are* important. In this case incorrectly formatted and poorly documented code has been cited as reasons to postpone promotion of this sandbox to a full module a few times already, so it would make sense to spend a few minutes running some automated tests yourself before each time you set this thread back to "needs review".
The fact that the whitespace errors are still there after multiple rounds of documentation and style revisions does kind of indicate to us that you either regularly forget, don't know how, are dismissive of or are too lazy to follow a basic, automated and well documented QA process before submitting your work publicly as "finished". As reviewers we want to get excited about new projects and new developers getting involved with the Drupal contrib community, so it's just a little disappointing when the test bots come back with fails on really simple, totally avoidable things.
Take things a little slower if you have to in order to get it right for this application, it's not a race :)
You don't have to use the hosted Ventral tool to review your code during active development as that can be a very slow and frustrating way to work. Just run it once at the end of each development cycle. If you haven't already, I highly recommend you configure something that works within your text editor so that automated reviews can be bound to a keyboard shortcut, like http://drupal.org/project/drupalcs.
Comment #20
Jordan_Fei CreditAttribution: Jordan_Fei commentedHi hapax legomenon,
For below code lines:
Is it correct using $node object to indicate a node save or not? Or you may use $node -> nid to
decide a node save or not.
Comment #21
klausiReview of the 7.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:
Setting this back to "needs work", you need to know where to use check_plain() and where not. Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.
Comment #22
klausiClosing due to lack of activity. Feel free to reopen if you are still working on this application.
If you reopen this please keep in mind that we are currently quite busy with all the project applications and I can only review projects with a review bonus. Please help me reviewing and I'll take a look at your project right away :-)
Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (found some problems with the project) or "reviewed & tested by the community" (found no major flaws).
Comment #23
Sansui CreditAttribution: Sansui commentedI stumbled onto this while working on a simple node insert for a webform. It's actually pretty useful in my use case scenario, hope you keep working on it :)
Comment #24
koppie CreditAttribution: koppie at Exygy for Cohere commentedFor anyone else stumbling upon this, here is a better alternative: https://www.drupal.org/project/webform_rules
Comment #25
apaderno