| Server IP : 195.130.67.5 / Your IP : 216.73.217.154 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/inetpub/wwwroot/business/ttt/views/modules/node/ |
Upload File : |
<?php
/**
* @file
* Definition of views_handler_field_node_path.
*/
/**
* Field handler to present the path to the node.
*
* @ingroup views_field_handlers
*/
class views_handler_field_node_path extends views_handler_field {
/**
* {@inheritdoc}
*/
public function option_definition() {
$options = parent::option_definition();
$options['absolute'] = array('default' => FALSE, 'bool' => TRUE);
return $options;
}
/**
* {@inheritdoc}
*/
public function construct() {
parent::construct();
$this->additional_fields['nid'] = 'nid';
}
/**
* {@inheritdoc}
*/
public function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
$form['absolute'] = array(
'#type' => 'checkbox',
'#title' => t('Use absolute link (begins with "http://")'),
'#default_value' => $this->options['absolute'],
'#description' => t('Enable this option to output an absolute link. Required if you want to use the path as a link destination (as in "output this field as a link" above).'),
'#fieldset' => 'alter',
);
}
/**
* {@inheritdoc}
*/
public function query() {
$this->ensure_my_table();
$this->add_additional_fields();
}
/**
* {@inheritdoc}
*/
public function render($values) {
$nid = $this->get_value($values, 'nid');
return url("node/$nid", array('absolute' => $this->options['absolute']));
}
}