workflow_views_handler_field_node_link_workflow.inc 907 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. /**
  3. * @file
  4. * Definition of workflow_views_handler_field_node_link_workflow.
  5. */
  6. /**
  7. * Field handler to present a link 'node workflow form'.
  8. *
  9. * @ingroup views_field_handlers
  10. */
  11. class workflow_views_handler_field_node_link_workflow extends views_handler_field_node_link {
  12. /**
  13. * Renders the link.
  14. */
  15. function render_link($node, $values) {
  16. // Ensure user has access to edit this node.
  17. $entity_type = $this->entity_type;
  18. // if (!node_access('update', $node)) {
  19. if (!workflow_tab_access($entity_type, $node)) {
  20. return;
  21. }
  22. $this->options['alter']['make_link'] = TRUE;
  23. $this->options['alter']['path'] = "node/$node->nid/workflow"; // @todo: add support for other entity types.
  24. $this->options['alter']['query'] = drupal_get_destination();
  25. $text = !empty($this->options['text']) ? $this->options['text'] : t('change state');
  26. return $text;
  27. }
  28. }