Guest User

Untitled

a guest
May 27th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. <?php
  2. class am_signup_handler_field_ops extends views_handler_field {
  3.  
  4. function query() {
  5. // do nothing -- to override the parent query.
  6. }
  7.  
  8. function render( $v ) {
  9. $tokens = $this->get_render_tokens($v);
  10. $tokens = array_map('strip_tags',$tokens);
  11. return l(
  12. t('remove'),
  13. strtr('am_signup/remove/' . $this->options['nid_token'] . '/' . $this->options['uid_token'],$tokens),
  14. array('attributes' => array('class'=> 'am-signup-remove-link'))
  15. );
  16. }
  17. function option_definition() {
  18. $options = parent::option_definition();
  19. $options['alter']['contains']['alter_text'] = array('default' => TRUE);
  20. $options['uid_token'] = array('default' => $this->definition['uid_token']);
  21. $options['nid_token'] = array('default' => $this->definition['nid_token']);
  22. return $options;
  23. }
  24. function options_form(&$form, &$form_state) {
  25. $tokens = array_keys($this->get_render_tokens());
  26. $tokens = array_combine($tokens,$tokens);
  27. $form['uid_token'] = array(
  28. '#title'=> 'User ID Field',
  29. '#type' => 'select',
  30. '#options' => $tokens,
  31. '#default_value' => $this->options['uid_token']
  32. );
  33.  
  34. $form['nid_token'] = array(
  35. '#title'=> 'Shift NID Field',
  36. '#type' => 'select',
  37. '#options' => $tokens,
  38. '#default_value' => $this->options['nid_token']
  39. );
  40. parent::options_form( $form, $form_state);
  41.  
  42. }
  43. }
Add Comment
Please, Sign In to add comment