Closed (fixed)
Project:
Web Links
Version:
6.x-2.x-dev
Component:
Testing
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
26 Jan 2015 at 19:23 UTC
Updated:
12 Aug 2015 at 17:54 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
jonathan1055 commentedHere's the patch
Comment #2
nancydruDevel has a hook for correctly generating extra fields in a node.
Comment #3
GStegemann commentedI have tested the patch and it works for me.
As Nancy mentioned we should use the devel hook to populate the url field.
Comment #4
jonathan1055 commentedOK. I've done some searching and found in file devel_generate.fields.inc the function devel_generate_fields which looks like it should be the one you are talking about. However, on running debug in this, the field 'url' is not returned in the field instances. For the weblinks node type we only get taxonomy_weblinks and body.
Later in this function we would execute
module_load_include('inc', $module, "$module.devel_generate");but only if we found a field defined by weblinks (which we don't)In file devel_generate.inc, function devel_generate_content_add_node(&$results) there is a comment:
which implies that we can use this to do things in our own hook_node_presave().
I suppose we should try to do it with the proper include file if possible, but I'm not sure that we can, as our 'url' is not a field as defined in real Drupal terminology, we store it ourselves in our own table. The various field_info functions are not aware of it, but maybe we can make them aware?
Comment #5
GStegemann commentedThanks for your research.
Yes, 'url' is currently not a real D7 field. I think as soon it will be made aware to the field_info functions it will also be filled by devel generate.
Comment #6
jonathan1055 commentedYes, but as far as I know, making url a full field would involve quite a bit of rework in the Weblinks code. Is that actually on our plan of things to do for 7.x-1.0?
One option would be to use the patch as supplied, but I will also add a note referring to this thread and saying to re-write with the specific devel_generate hook if/when we change the url to a real field. That way, we get the benefit now of a properly populated url for our testing, but we do not lose sight of the fact that there is another way to do it.
Comment #7
GStegemann commentedNo, for 7.x-1.0 we should not make url as a full field.
I would opt for your option to use the patch as supplied and adding a note as you have described.
Comment #8
jonathan1055 commentedThere is a nice discussion on whether to convert url to a field in #1197770: Roadmap reminder
Here is a patch with the extra comments.
Comment #9
GStegemann commentedYes, I remember. But at that point in time I didn't know very much about all the impacts such a decision would have.
Comments are OK.
Comment #11
jonathan1055 commentedThanks for testing.
Comment #13
jonathan1055 commentedThe same functionality is useful in 6.x too. Anything that saves us time and effort when testing/debugging is worth porting back.
The code addition is identical, but it goes in weblinks_nodeapi op=presave, instead of weblinks_node_presave.
Comment #14
GStegemann commentedYes, sure.
Tested and works. Thank you.
Comment #16
jonathan1055 commentedGreat! Thanks for testing.
Comment #18
jonathan1055 commentedThe issue is fixed. Old patch from #13 got requeued, and obviously it fails to apply because the code change is already committed in #15.