I have these nodes : Company, Cars, Trucks (cars and truck have a taxonomy term to give it's type). Cars and Trucks have a field named Company wich refer to the Company node.

So i can locate the vehicle location on a map. I know how to create a form wich allow the company's administrator to add some cars (with this subject : How do I embed a node creation form inside a view)

But i want to give a field like "Select your vehicule's type" -> "Car" or "Truck" and it shows the right form to add a new vehicle.

I want too, restrict the selection of vehicules types by user group. Then me as an administrator i want to have the possibility to select all types of vehicle, but an user group like "Motorbike Company" can use only "Motorbikes" or allow "Truck company" to use "Trucks" and Cars".

And finaly, in Campany i've a field "Vehicles" and when the company's administrator add a new vehicle, i want it add too in the "Vehicles" field of the "Company" node.

Can you help me to did that ? I use Views and Display Suite. i'm novice with Drupal and i request your help :)

1 Answer 1


As you're using plain php (not really bestpractice) you can code it out yourself there, having a select changing a query-parameter for your view (self made contextual filter ..).

A more sophisticated approach would be hooking your view, hook_views_pre_render:

This hook is called right before the render process. The query has been executed, and the pre_render() phase has already happened for handlers, so all data should be available.

Adding output to the view can be accomplished by placing text on $view->attachment_before and $view->attachment_after. Altering the content can be achieved by editing the items of $view->result.

Or create a custom page-callback (see hook_menu), where you embed the view and add the form regarding your query param (or uri param).

You can check permissions with user_access.

You won't need to enable php execution with these approaches !

  • Thanks i'll search to made this. I thinking there was a solution without programming it. Let's do this !
    – Kpone
    Apr 18, 2016 at 15:03

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.