| 1 |
$Id: USAGE.txt,v 1.2 2008/03/12 21:17:50 add1sun Exp $ |
$Id: USAGE.txt,v 1.2.2.1 2009/10/07 23:19:40 brauerranch Exp $ |
| 2 |
|
|
| 3 |
See README.txt for a description of this module. |
See README.txt for a description of this module. |
| 4 |
See this documentation online at http://drupal.org/node/228167. |
See this documentation online at http://drupal.org/node/228167. |
| 86 |
name="body" rows="20" cols="60"/> |
name="body" rows="20" cols="60"/> |
| 87 |
|
|
| 88 |
You can't just take the name "body," throw it into a edit[body] and |
You can't just take the name "body," throw it into a edit[body] and |
| 89 |
expect it to work. Drupal wraps the body field into a "body_filter" |
expect it to work. Drupal wraps the body field into a "body_field" |
| 90 |
array when it gets processed. So, for body fields, a URL like: |
array when it gets processed. So, for body fields, a URL like: |
| 91 |
|
|
| 92 |
http://www.example.com/node/add/content?edit[body_filter][body]=This is the body |
http://www.example.com/node/add/content?edit[body_field][body]=This is the body |
| 93 |
|
|
| 94 |
ought to do the trick. |
ought to do the trick. |
| 95 |
|
|
| 100 |
Prepopulate can handle pre-filling multiple fields from one URL. Just |
Prepopulate can handle pre-filling multiple fields from one URL. Just |
| 101 |
separate the edit variables with an ampersand: |
separate the edit variables with an ampersand: |
| 102 |
|
|
| 103 |
http://www.example.com/node/add/content?edit[title]=The title&edit[body_filter][body]=The body |
http://www.example.com/node/add/content?edit[title]=The title&edit[body_field][body]=The body |
| 104 |
|
|
| 105 |
You're already using the ampersand with non-clean URLs: |
You're already using the ampersand with non-clean URLs: |
| 106 |
|
|
| 107 |
http://www.example.com?q=node/add/content&edit[title]=The title&edit[body_filter][body]=The body |
http://www.example.com?q=node/add/content&edit[title]=The title&edit[body_field][body]=The body |
| 108 |
|
|
| 109 |
|
|
| 110 |
Escaping special characters |
Escaping special characters |
| 124 |
Bookmarklets |
Bookmarklets |
| 125 |
------------ |
------------ |
| 126 |
|
|
| 127 |
Prepopulate.module was created for bookmarklets. Here is the actual |
Prepopulate.module was created for bookmarklets. Here is a bookmarklet for |
| 128 |
bookmarklet I use to post web links to my site: |
posting web links to a site: |
| 129 |
|
|
| 130 |
javascript:u=document.location.href;t=document.title;s=window.getSelection();void(window.open(%22http://oif.eafarris.com/node/add/content-web-link?edit[title]=%22+escape(t)+'&edit[body_filter][body]='+escape(s)+'&edit[field_url][0][value]='+escape(u),'_blank','width=1024,height=500,status=yes,resizable=yes,scrollbars=yes')); |
javascript:u=document.location.href;t=document.title;s=window.getSelection();void(window.open(%22http://example.com/node/add/content-web-link?edit[title]=%22+escape(t)+'&edit[body_field][body]='+escape(s)+'&edit[field_url][0][value]='+escape(u),'_blank','width=1024,height=500,status=yes,resizable=yes,scrollbars=yes')); |
| 131 |
|
|
| 132 |
This turns into a URL like this: |
This turns into a URL like this: |
| 133 |
|
|
| 134 |
http://oif.eafarris.com/node/add/content-web-link?edit[title]=drupal.org%20%7C%20Community%20plumbing&edit[body_filter][body]=&edit[field_url][0][value]=http%3A//drupal.org/ |
http://example.com/node/add/content-web-link?edit[title]=drupal.org%20%7C%20Community%20plumbing&edit[body_field][body]=&edit[field_url][0][value]=http%3A//drupal.org/ |
| 135 |
|
|
| 136 |
If I had first selected some text on the page, it would be put into the |
Selecting some text on the page first would put that text into the |
| 137 |
body of the node. |
body of the node. |
| 138 |
|
|
| 139 |
Happy prepopulating! |
Happy prepopulating! |