views_handler_field_term_link_edit.inc

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

Definition of views_handler_field_term_link_edit.

Classes

Namesort descending Description
views_handler_field_term_link_edit Field handler to present a term edit link.

File

sites/all/modules/ulmus/views/modules/taxonomy/views_handler_field_term_link_edit.inc
View source
  1. <?php
  2. /**
  3. * @file
  4. * Definition of views_handler_field_term_link_edit.
  5. */
  6. /**
  7. * Field handler to present a term edit link.
  8. *
  9. * @ingroup views_field_handlers
  10. */
  11. class views_handler_field_term_link_edit extends views_handler_field {
  12. function construct() {
  13. parent::construct();
  14. $this->additional_fields['tid'] = 'tid';
  15. $this->additional_fields['vid'] = 'vid';
  16. $this->additional_fields['vocabulary_machine_name'] = array(
  17. 'table' => 'taxonomy_vocabulary',
  18. 'field' => 'machine_name',
  19. );
  20. }
  21. function option_definition() {
  22. $options = parent::option_definition();
  23. $options['text'] = array('default' => '', 'translatable' => TRUE);
  24. return $options;
  25. }
  26. function options_form(&$form, &$form_state) {
  27. $form['text'] = array(
  28. '#type' => 'textfield',
  29. '#title' => t('Text to display'),
  30. '#default_value' => $this->options['text'],
  31. );
  32. parent::options_form($form, $form_state);
  33. }
  34. function query() {
  35. $this->ensure_my_table();
  36. $this->add_additional_fields();
  37. }
  38. function render($values) {
  39. // Check there is an actual value, as on a relationship there may not be.
  40. if ($tid = $this->get_value($values, 'tid')) {
  41. // Mock a term object for taxonomy_term_edit_access(). Use machine name and
  42. // vid to ensure compatibility with vid based and machine name based
  43. // access checks. See http://drupal.org/node/995156
  44. $term = new stdClass();
  45. $term->vid = $values->{$this->aliases['vid']};
  46. $term->vocabulary_machine_name = $values->{$this->aliases['vocabulary_machine_name']};
  47. if (taxonomy_term_edit_access($term)) {
  48. $text = !empty($this->options['text']) ? $this->options['text'] : t('edit');
  49. $tid = $this->get_value($values, 'tid');
  50. return l($text, 'taxonomy/term/'. $tid . '/edit', array('query' => drupal_get_destination()));
  51. }
  52. }
  53. }
  54. }
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.