Reputation: 11
I have some entity type and I have page with link on press which I want to call drupal form for creating
new node of my entity type. Link looks like http://testname/categories/category/222/555?page=1#overlay=node/add/entity_type
.
How to take paths from url, in my case - numbers, and show it in fields of adding form?
I can use "get" parametrs in link, but how I can make it default values for new node or display in fields of drupal form for creating new node?
Thanks.
Upvotes: 0
Views: 384
Reputation: 186
To get the query parameters use the arg(index) function where index is the position of the parameter in the url, i.e. arg(0) = categories.
To display default values in a form use the #default_value attribute to a field. For more information use the Drupal Form Api reference.
Upvotes: 1