data_node_views_handler_field_add_remove.inc

Class defition for data_node_views_handler_field_add_remove.

Classes

File

sites/all/modules/local_contrib/data/data_node/views/data_node_views_handler_field_add_remove.inc
View source
  1. <?php
  2. /**
  3. * @file
  4. * Class defition for data_node_views_handler_field_add_remove.
  5. */
  6. class data_node_views_handler_field_add_remove extends views_handler_field {
  7. protected $table_name, $id;
  8. function allow_advanced_render() {
  9. return FALSE;
  10. }
  11. function query() {
  12. $this->ensure_my_table();
  13. // Add the id field for this table to the query.
  14. $table = data_get_table($this->view->base_table);
  15. $meta = $table->get('meta');
  16. if ($meta['data_node']['content_type']) {
  17. // Copy table name, we will use it in render().
  18. $this->table_name = $table->get('name');
  19. // Add id field to query.
  20. $this->id = $this->query->add_field($this->table_alias, $meta['data_node']['id']);
  21. }
  22. $this->add_additional_fields();
  23. }
  24. function render($values) {
  25. if (user_access('manage data relations')) {
  26. $id = $values->{$this->id};
  27. $table = data_get_table($this->table_name);
  28. $node_list = data_node_get_nids($table, $id);
  29. if ($nid = data_node_get_active($this->table_name)) {
  30. return in_array($nid, $node_list) ? data_node_render_remove_link($table, $id, $nid) : data_node_render_add_link($table, $id, $nid);
  31. }
  32. else {
  33. return data_node_render_placeholder_link($table, $id);
  34. }
  35. }
  36. }
  37. }
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.