home | career | drupal | java | mac | mysql | perl | php | scala | uml | unix

Drupal example source code file (views_handler_field_filter_format_name.inc)

This example Drupal source code file (views_handler_field_filter_format_name.inc) is included in the DevDaily.com "Drupal Source Code Warehouse" project. The intent of this project is to help you "Learn Drupal by Example".

PHP - Drupal tags/keywords

check_plain, extends, filter_formats, format_name, function, if, parent::construct, php, query, render, return, values, views_handler_field, views_handler_field_filter_format_name

The views_handler_field_filter_format_name.inc Drupal example source code

<?php
// $Id: views_handler_field_filter_format_name.inc,v 1.2.4.2 2010/05/22 11:57:38 dereine Exp $
/**
 * Field handler to output the name of an input format.
 */
class views_handler_field_filter_format_name extends views_handler_field {
  function construct() {
    parent::construct();
    // Be explicit about the table we are using.
    $this->additional_fields['name'] = array('table' => 'filter_formats', 'field' => 'name');
  }

  function query() {
    $this->ensure_my_table();
    $this->add_additional_fields();
  }

  function render($values) {
    $format_name = $values->{$this->aliases['name']};
    if (!$format_name) {
      // Default or invalid input format.
      // filter_formats() will reliably return the default format even if the
      // current user is unprivileged.
      $format = filter_formats(filter_default_format());
      return check_plain($format->name);
    }
    return check_plain($format_name);
  }
}

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal views_handler_field_filter_format_name.inc source code file:

new blog posts

"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.