1

I have a page which shows the details of an Event content type item. I added in my second sidebar a block which content a button. Here is a screenprint of what I have so far:

enter image description here

I want to use this button to update the status of the item (a field with machine name "field_event_status"). Before the validation I want to show a confirm popup.

Any help to get this to work?

3
  • Please review the edit I just applied to your question (trying to improve it). Feel free to further enhance it (eg: which Drupal version are you using? Or explain why you tagged this question with "rules"). If you don't like my edit at all, just perform a "rollback" to your prior question. Commented Feb 6, 2017 at 18:00
  • I see 2 buttons in your 2nd sidebar labeled "send invitation" and "Validate this event". Can you improve your question to indicate which "button" you want to use to perform that status update? Maybe also indicate if we can just ignore that other button in the context of this question here? Commented Feb 6, 2017 at 18:09
  • It's the bottom button I use. The button is inside a block.And I use Global textarea do design it.
    – Z.Lass
    Commented Feb 6, 2017 at 18:14

1 Answer 1

2

It appears to me that you should start with using the Flag module, with a so called "global" flag. And configure your flag so that it would show an appropriate "confirmation" whenever such node gets flagged.

Next you could use the Rules module and create a custom rule like so:

  • Rules Event: A node has been flagged, under "Some flag" (= the flag's label).
  • Rules Condition: Entity has field (related to your field_event_status field), to make it available for further processing in subsequent Rules Events and/or Rules Actions.
  • Rules Action: Set a data value (related to your field_event_status field).

With that you have the mechanics (logic) in place, and the only think left is theming the flag link(s) to have them shown as buttons. If you wonder how to make that happen also, then have a look at my answer to "How to add a custom icon or symbol to a flag link?" (i.e. the Option 2 part of it).

Tutorials

If you're not familiar with the Flag module, checkout the set of 8 video tutorials about the Flag module. Especially these tutorials from it:

More info

Refer to Flag's Community documentation for (way) more details.

5
  • Thank for you good response. I take a look around it the video tutorials. I use DRUPAL 7
    – Z.Lass
    Commented Feb 6, 2017 at 18:19
  • @Z.Lass : merci for the accept! Next question, if any? Or are you a flag/rules expert now? Commented Feb 8, 2017 at 16:18
  • hahahaha. Thank you!!! Not an expert. But it solved my problem. Are you use sometime view php?yes, I have another question!
    – Z.Lass
    Commented Feb 8, 2017 at 16:34
  • @Z.Lass : "views PHP"??? No, never (storing PHP in the database is bad ...). Similar answer about using Rules Conditions and Rules Actions that are "execute a PHP script". Commented Feb 8, 2017 at 16:39
  • Okey I open another question topic
    – Z.Lass
    Commented Feb 8, 2017 at 16:46

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.