|
|
Drupal example source code file (views_handler_field_file_uri.inc)
The views_handler_field_file_uri.inc Drupal example source code<?php // $Id: views_handler_field_file_uri.inc,v 1.1.2.1 2010/10/06 17:47:37 dereine Exp $ /** * Field handler to add rendering file paths as file URLs instead of as internal file URIs. */ class views_handler_field_file_uri extends views_handler_field_file { function option_definition() { $options = parent::option_definition(); $options['file_download_path'] = array('default' => FALSE); return $options; } function options_form(&$form, &$form_state) { parent::options_form($form, $form_state); $form['file_download_path'] = array( '#title' => t('Display download path instead of file storage URI'), '#description' => t('This will provide the full download URL rather than the internal filestream address.'), '#type' => 'checkbox', '#default_value' => !empty($this->options['file_download_path']), ); } function render($values) { $data = $values->{$this->field_alias}; if (!empty($this->options['file_download_path']) && $data !== NULL && $data !== '') { $data = file_create_url($data); } return $this->render_link($data, $values); } } Other Drupal examples (source code examples)Here is a short list of links related to this Drupal views_handler_field_file_uri.inc source code file: |
"Drupal" is a registered trademark of Dries Buytaert.
my drupal tutorials and examples
Copyright
1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.
Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.