accessibility_handler_link_field.inc

  1. cis7 sites/all/modules/ulmus/accessibility/views/accessibility_handler_link_field.inc
  2. cle7 sites/all/modules/ulmus/accessibility/views/accessibility_handler_link_field.inc
  3. ecd7 sites/all/modules/ulmus/accessibility/views/accessibility_handler_link_field.inc
  4. elmsmedia7 sites/all/modules/ulmus/accessibility/views/accessibility_handler_link_field.inc
  5. harmony7 sites/all/modules/ulmus/accessibility/views/accessibility_handler_link_field.inc
  6. icor7 sites/all/modules/ulmus/accessibility/views/accessibility_handler_link_field.inc
  7. meedjum_blog7 sites/all/modules/ulmus/accessibility/views/accessibility_handler_link_field.inc
  8. mooc7 sites/all/modules/ulmus/accessibility/views/accessibility_handler_link_field.inc

Contains a Views field handler to take care of displaying links to entities as fields.

Classes

File

sites/all/modules/ulmus/accessibility/views/accessibility_handler_link_field.inc
View source
  1. <?php
  2. /**
  3. * @file
  4. * Contains a Views field handler to take care of displaying links to entities
  5. * as fields.
  6. */
  7. class accessibility_handler_link_field extends views_handler_field {
  8. function construct() {
  9. parent::construct();
  10. $this->additional_fields['test_id'] = 'test_id';
  11. }
  12. function option_definition() {
  13. $options = parent::option_definition();
  14. $options['text'] = array('default' => '', 'translatable' => TRUE);
  15. return $options;
  16. }
  17. function options_form(&$form, &$form_state) {
  18. parent::options_form($form, $form_state);
  19. $form['text'] = array(
  20. '#type' => 'textfield',
  21. '#title' => t('Text to display'),
  22. '#default_value' => $this->options['text'],
  23. );
  24. }
  25. function query() {
  26. $this->ensure_my_table();
  27. $this->add_additional_fields();
  28. }
  29. function render($values) {
  30. $text = !empty($this->options['text']) ? $this->options['text'] : t('view');
  31. $accessibility_id = $values->{$this->aliases['test_id']};
  32. return l($text, 'accessibility-test/' . $accessibility_id);
  33. }
  34. }