I'm administrating a public site and there's some other guys who add content, too. We have a page with articles with a certain tag (let's call it theTag) which has an address like the-site.com/taxonomy/term/41. Now, since other users are not advanced ones (and for general convenience) I'd like to create a button which:

  1. adds an article (opens the the-site.com/node/add/article or the corresponding overlay) with pre-set theTag
  2. also I'd like the "is shown on the main page" flag (not sure about the exact name, it's "Помещено на главную страницу" in Russian) unset, so that the article is show only on the the-site.com/taxonomy/term/41 page, not on the main one
  3. the button should obviously be shown only to those who can edit

How to implement that? It sounds like a common feature, but googling didn't help. Since I'm totally new to Drupal internals, I'd appreciate any partial suggestions if you think I'm asking for too much.

PS may be there's some params that I can use in the the-site.com/node/add/article url (like, say, the-site.com/node/add/article?tag=theTag) so that the corresponding tag is pre-set in the new article form?

  • is your tag static or dynamic? I mean each time you want use specified tag name or always use one?
    – Yuseferi
    Sep 15, 2016 at 12:59
  • @zhilevan just the same tag each time, so static
    – YakovL
    Sep 15, 2016 at 13:11
  • do you prefer pass term name or term id? can you tell me your content type name and your tag field machine name ( I can guest they are article and field_tags) ?
    – Yuseferi
    Sep 15, 2016 at 14:23
  • @zhilevan nice specification. Since I'm not going to create many of such buttons anyway (just one for now), I think both will do, but term id sounds a bit better since renaming the term wouldn't break the code. Content type name is definitely article; not totally sure about the tag field machine name, but the input's DOM is <input type="text" id="edit-field-tags-und" name="field_tags[und]" value="" size="60" maxlength="1024" class="form-text form-autocomplete" autocomplete="OFF" aria-autocomplete="list"> which suggests you're right.
    – YakovL
    Sep 15, 2016 at 17:14
  • where do you want put this button? in drupal we have link to create url as example in content > add content > article would like to have a link for it , as exmaple content > add content > Помещено на главную страницу ?
    – Yuseferi
    Sep 15, 2016 at 18:12

1 Answer 1


Sounds like the Prepopulate module does exactly what you want.

EDIT: From the module's page:

The Prepopulate module allows fields in most forms to be pre-populated from the $_REQUEST variable.

For example, the following URL,

http://www.example.com/node/add/blog?edit[title]=this is the title

will automatically fill the Title field on a new blog post with the words "this is the title". Any field can be prepopulated this way, including taxonomy and CCK fields. You can prepopulate more than one field at a time as well. Prepopulate is excellent for creating bookmarklets. For examples on usage for all of these cases, please read the USAGE.txt file that comes with the module or you can read the online handbook page.

  • Hi, thanks. The plugin looks useful, but I failed to set a tag with it. The DOM of the tags input is the following: jsfiddle.net/ge8sLux9 . I've tried the-site.com/node/add/article?edit[field_tags][und]=test, ?edit[field_tags[und]]=test and various others like ?edit[tags]=test, ?edit[tags][0]=test etc, but without success (although ?edit[title]=test worked for me). I also failed to set the "to the main page" checkbox (name="promote", I tried edit[promote]=false and edit[promote]=0).
    – YakovL
    Sep 16, 2016 at 15:25
  • The documentation of the module doesn't say what to do with hidden and disabled inputs, but I guess you can try any of the combinations given in the documentation: drupal.org/node/228167
    – Jelle
    Sep 19, 2016 at 6:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.