Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6086721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:47:17+00:00 2026-05-23T11:47:17+00:00

I’m trying to create my own custom format output of Views. I’ve had partial

  • 0

I’m trying to create my own custom format output of Views. I’ve had partial success with this code:

my_module.module:

<?php
function my_module_views_api() { // your module name into hook_views_api
  return array(
    'api' => 2,
    // might not need the line below, but in any case, the last arg is the name of your module
    'path' => drupal_get_path('module', 'my_module'),
  );
}
?>

my_module.views.inc:

<?php
/**
 * Implementation of hook_views_plugins().
 */
function my_module_views_plugins() {
  $path = drupal_get_path('module', 'my_module');
  return array(
    'style' => array(
      'my_module' => array(
        'title' => t('my_module'),
        'handler' => 'views_plugin_style_default',
        'theme' => 'my_module',
        'theme path' => $path . '/theme',
        'theme file' => 'my-module.tpl.php',
        'uses row plugin' => TRUE,
        'uses row class' => TRUE,
        'uses grouping' => TRUE,
        'uses options' => TRUE,
        'type' => 'normal',
      )
    ),
  );
}
?>

theme/my-module.tpl.php:

<?php
/**
 * @file views-view-unformatted.tpl.php
 * Default simple view template to display a list of rows.
 *
 * @ingroup views_templates
 */
 if (!empty($title)): 
   print $title; 
 endif; 
 foreach ($rows as $id => $row): 
 ?>
 ROW:
 <?php
 print_r($row);
 endforeach; 
 ?>

The above is successful in that it will use my custom my-module.tpl.php to output rows. However, the rows are pre-formatted, presumable by the views_plugin_style_default handler. I’ve spent hours trying to create my own such handler, with no success, either placing it directly in the views/plugins directory or in my module’s own plugins directory. I also can’t find any good examples online and I don’t get any useful error messages to help me debug.

Is there any proper documentation on how to create a custom views handler? Or can you provide a working example?

Thank you very much!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T11:47:18+00:00Added an answer on May 23, 2026 at 11:47 am

    There is a tutorial here: http://groups.drupal.org/node/10129. Scroll down to “Writing Views 2 style and row plugins”. In the tutorial example, they create both a style and a row plugin.

    As an alternative, I tried creating just a style plugin, similar to yours except I set ‘uses row plugin’ to false. I was then able to access the raw rowdata from within my views-view-myplugin.tpl.php template.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I'm trying to create an if statement in PHP that prevents a single post
I am trying to understand how to use SyndicationItem to display feed which is
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.