Download & Extend

CTools Plugin Example module provided for inclusion with CTools

Project:Chaos tool suite (ctools)
Version:6.x-1.0-rc1
Component:Documentation
Category:task
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

The attached (as both patch and tgz) is a coder's example module for Ctools. It provides example argument, context, content type, access, and relationship plugins, along with a demo panel and advanced help. It also shows how a module can provide a default panel. I hope it can be useful.

AttachmentSize
ctools_plugin_example_module.patch68.07 KB
ctools_plugin_example_module.tgz14.01 KB

Comments

#1

I've attached the .module file, which I've cleaned up for several style issues. You can use it as a guide for some things that need to be looked at.

  • It should always be ctools or CTools, never Ctools.
  • Avoid heredoc for text since that can't be properly run through t().
  • Titles should only be capitalized on the first word. i.e, "This is a title" not "This is a Title" or "This Is A Title".
  • Mostly avoid two blank lines.
  • Try not to have the @file section accidentlly be the doxy block for a function. A couple of the .inc files have this.
  • This is an artifact of the growth of the plugin system, but the main function of the .inc file should not define an array with a key. Instead it should just return the single array. There are a few in CTools that still do this the old way; I change them as I see them. (patches to fix that would be accepted!).
  • The content types are using an older format. Content types can do a lot more to infer names, particularly on render and settings. Compare to the current content types.
  • Use this format:
    * @param $variable
    *   definition
AttachmentSize
ctools_plugin_example.module.txt 3.43 KB

#2

This is very useful, thx!

#3

Yes this is useful, and the explanation includes useful tips in general

#4

Title:Ctools Plugin Example module provided for inclusion with Ctools» CTools Plugin Example module provided for inclusion with CTools
Status:active» needs review

Here is another rev of the module that (I hope) addresses the issues in #1. Thanks.

AttachmentSize
ctools_plugin_example.20090817.tgz 12.01 KB

#5

Status:needs review» fixed

Ok, committed. Let's run with this and we can patch to refine it as we go.

#6

#7

Thank you so much!!!

#8

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here