views_handler_field_node_path.inc

  1. 3.x modules/node/views_handler_field_node_path.inc
  2. 2.x modules/node/views_handler_field_node_path.inc

File

modules/node/views_handler_field_node_path.inc
View source
  1. <?php
  2. // $Id:
  3. /**
  4. * Field handler to present the path to the node.
  5. */
  6. class views_handler_field_node_path extends views_handler_field {
  7. function option_definition() {
  8. $options = parent::option_definition();
  9. $options['absolute'] = array('default' => FALSE);
  10. return $options;
  11. }
  12. function construct() {
  13. parent::construct();
  14. $this->additional_fields['nid'] = 'nid';
  15. }
  16. function options_form(&$form, &$form_state) {
  17. parent::options_form($form, $form_state);
  18. $form['absolute'] = array(
  19. '#type' => 'checkbox',
  20. '#title' => t('Use absolute link (begins with "http://")'),
  21. '#default_value' => $this->options['absolute'],
  22. '#description' => t('If you want to use this as in "output this field as link" in "link path", you must enable this option.'),
  23. );
  24. }
  25. function query() {
  26. $this->ensure_my_table();
  27. $this->add_additional_fields();
  28. }
  29. function render($values) {
  30. $nid = $values->{$this->aliases['nid']};
  31. return url("node/$nid", array('absolute' => $this->options['absolute']));
  32. }
  33. }