Skip to main content
Title fix
Source Link
Beebee
  • 6.9k
  • 2
  • 34
  • 56

Add a form to the list outoutoutput of a view

Assume that I'weI've created a view that outputs a list of cars. For each car, I display the name and the age of the car. This is all done with the Drupal UI. Now I'd like to add a simple button (Set as favorite) at the end of each line that when clicked saves the ID of the chosen car in a user's session variable. So my view table should look like the following:

Name Age Button
car1 23  'set as favorite'
car2 10  'set as favorite'

I am not asking about the session-variable part, but only how I can alter the view output to add a simple button to each row of the list output (I bet it'll be a form in each row) to each row of the list output.

I've done a lot of reading and I bet this could be done with hook_views_data_alter or some other hook_views_* but I'm not proceeding. I've already tried drop-buttons as suggested on Add custom action buttons to a view, but that does not solve the things I need. I need the car's ID I want to save in a session variable, so basically I need a form functionality.

Add a form to the list outout of a view

Assume that I'we created a view that outputs a list of cars. For each car, I display the name and the age of the car. This is all done with the Drupal UI. Now I'd like to add a simple button (Set as favorite) at the end of each line that when clicked saves the ID of the chosen car in a user's session variable. So my view table should look like the following:

Name Age Button
car1 23  'set as favorite'
car2 10  'set as favorite'

I am not asking about the session-variable part, but only how I can alter the view output to add a simple button (I bet it'll be a form in each row) to each row of the list output.

I've done a lot of reading and I bet this could be done with hook_views_data_alter or some other hook_views_* but I'm not proceeding. I've already tried drop-buttons as suggested on Add custom action buttons to a view, but that does not solve the things I need. I need the car's ID I want to save in a session variable, so basically I need a form functionality.

Add a form to the list output of a view

Assume that I've created a view that outputs a list of cars. For each car, I display the name and the age of the car. This is all done with the Drupal UI. Now I'd like to add a simple button (Set as favorite) at the end of each line that when clicked saves the ID of the chosen car in a user's session variable. So my view table should look like the following:

Name Age Button
car1 23  'set as favorite'
car2 10  'set as favorite'

I am not asking about the session-variable part, but only how I can alter the view output to add a simple button to each row of the list output (I bet it'll be a form in each row).

I've done a lot of reading and I bet this could be done with hook_views_data_alter or some other hook_views_* but I'm not proceeding. I've already tried drop-buttons as suggested on Add custom action buttons to a view, but that does not solve the things I need. I need the car's ID I want to save in a session variable, so basically I need a form functionality.

improved spelling and grammar
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

Assume that I'we created a view that outputs a list of cars. For each car, I display the name and the age of the car. This is all done with the Drupal UI. Now I'd like to add a simple button ('set as favorite')(Set as favorite) at the end of each line that when clicked saves the idID of the chosen car in a user's session variable. So my view table should look like the following:

Name Age Button
car1 23  'set as favorite'
car2 10  'set as favorite'

I am not asking about the session-variable part, but only how can I can alter the view output to add a simple button (I bet it'll be a form in each row) to each row of the list output ?.

I've done a lot of reading and I bet this could be done with hook_views_data_alter or some other hook_views_* but I'm not proceeding. I've already tried dropbuttonsdrop-buttons as suggested on hereAdd custom action buttons to a view, but still that does not solve the things I need (i.e. I need the car's id thatID I want to save in a session variable, so basically I need a form functionality).

Assume that I'we created a view that outputs a list of cars. For each car I display the name and the age of the car. This is all done with the Drupal UI. Now I'd like to add a simple button ('set as favorite') at the end of each line that when clicked saves the id of the chosen car in a user's session variable. So my view table should look like the following:

Name Age Button
car1 23  'set as favorite'
car2 10  'set as favorite'

I am not asking about the session-variable part, but only how can I alter the view output to add a simple button (I bet it'll be a form in each row) to each row of the list output ?

I've done a lot of reading and I bet this could be done with hook_views_data_alter or some other hook_views_* but I'm not proceeding. I've already tried dropbuttons as suggested here but still that does not solve the things I need (i.e. I need the car's id that I want to save in a session variable, so basically I need a form functionality)

Assume that I'we created a view that outputs a list of cars. For each car, I display the name and the age of the car. This is all done with the Drupal UI. Now I'd like to add a simple button (Set as favorite) at the end of each line that when clicked saves the ID of the chosen car in a user's session variable. So my view table should look like the following:

Name Age Button
car1 23  'set as favorite'
car2 10  'set as favorite'

I am not asking about the session-variable part, but only how I can alter the view output to add a simple button (I bet it'll be a form in each row) to each row of the list output.

I've done a lot of reading and I bet this could be done with hook_views_data_alter or some other hook_views_* but I'm not proceeding. I've already tried drop-buttons as suggested on Add custom action buttons to a view, but that does not solve the things I need. I need the car's ID I want to save in a session variable, so basically I need a form functionality.

assume IAssume that I'we created a view that outputs a list of cars. For each car I display the name and the age of the car. This is all done with the Drupal UI. Now I'd like to add a simple button ('set as favorite')('set as favorite') at the end of each line that when clicked saves the id of the chosen car in a user's session variable. So my view table should look like the following:

nameName ageAge buttonButton
car1 23  'set as favorite'
car2 10  'set as favorite'

I am not asking about the session-variable part, but only how can I alter the view output to add a simple button (I bet it'll be a form in each row) to each row of the list output ?

I've done a lot of reading and I bet this could be done with hook_views_data_alter or some other hook_views_* but I'm not proceeding. I've already tried dropbuttons as suggested here but still that does not solve the things I need (i.e. I need the car's id that I want to save in a session variable, so basically I need a form functionality)

Thanks

assume I created a view that outputs a list of cars. For each car I display the name and the age of the car. This is all done with Drupal UI. Now I'd like to add a simple button ('set as favorite') at the end of each line that when clicked saves the id of the chosen car in a user's session variable. So my view table should look like the following:

name age button
car1 23  'set as favorite'
car2 10  'set as favorite'

I am not asking about the session-variable part, but only how can I alter the view output to add a simple button (I bet it'll be a form in each row) to each row of the list output ?

I've done a lot of reading and I bet this could be done with hook_views_data_alter or some other hook_views_* but I'm not proceeding. I've already tried dropbuttons as suggested here but still that does not solve the things I need (i.e. I need the car's id that I want to save in a session variable, so basically I need a form functionality)

Thanks

Assume that I'we created a view that outputs a list of cars. For each car I display the name and the age of the car. This is all done with the Drupal UI. Now I'd like to add a simple button ('set as favorite') at the end of each line that when clicked saves the id of the chosen car in a user's session variable. So my view table should look like the following:

Name Age Button
car1 23  'set as favorite'
car2 10  'set as favorite'

I am not asking about the session-variable part, but only how can I alter the view output to add a simple button (I bet it'll be a form in each row) to each row of the list output ?

I've done a lot of reading and I bet this could be done with hook_views_data_alter or some other hook_views_* but I'm not proceeding. I've already tried dropbuttons as suggested here but still that does not solve the things I need (i.e. I need the car's id that I want to save in a session variable, so basically I need a form functionality)

Source Link
theuni
  • 865
  • 7
  • 25
Loading