Leveraging the Chaos tool suite  for module development
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Leveraging the Chaos tool suite for module development

on

  • 5,518 views

CTools, aka the Chaos tool suite is one of the most popular and arguably least understood modules in the contributions repository. While most users will enable it only because of a dependency (i.e. ...

CTools, aka the Chaos tool suite is one of the most popular and arguably least understood modules in the contributions repository. While most users will enable it only because of a dependency (i.e. panels), there are some wonderful gems in this tool kit that simplify module development.

Statistics

Views

Total Views
5,518
Views on SlideShare
5,474
Embed Views
44

Actions

Likes
8
Downloads
57
Comments
0

1 Embed 44

http://www.slideshare.net 44

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />

Leveraging the Chaos tool suite for module development Presentation Transcript

  • 1. Embracing chaos Leveraging the Chaos tool suite for module development
  • 2. @zroger drupal.org/user/67977
  • 3. What is CTools?
  • 4. “This suite is primarily a set of APIs and tools to improve the developer experience. It also contains a module called the Page Manager whose is to manage pages. In particular it manages panel pages, but as it grows it will be able to manage far more than just Panels.” - http://drupal.org/project/ctools
  • 5. Credit: http://www.flickr.com/photos/ontario_wanderer
  • 6. The Tools • Plugins • Modal Dialog • Exportables • Dependent • AJAX Responder • Content • Form Tools • Form wizard • Object caching • CSS Tools • Contexts • Others*
  • 7. Credit: http://www.flickr.com/photos/jakematesdesign
  • 8. Plugins • Variation of the hook system • Extensions of modules • Several implementation methods • Implementation by other modules • And themes too!
  • 9. Credit: http://www.flickr.com/photos/thomashawk
  • 10. Exportables • Allows for exportable objects • Exported objects run from code • CTools handles the overrides • Implemented in hook_schema()
  • 11. Form Tools • replacements for Drupal's form functions • ctools_build_form instead of drupal_get_form = • uses form_state exclusively, no function args • basis of modal dialog and form wizard
  • 12. AJAX Responder Credit: http://www.flickr.com/photos/jimmyroq
  • 13. AJAX Responder • Command passing framework • Common language (JSON) • Command execution happens in javascript • Command invocation happens in PHP
  • 14. Click Handler AJAX Callback AJAX Command
  • 15. Modal Dialog • Built on top of AJAX Responder • Works especially well with forms • Handles form validation and submission workflows
  • 16. Object Cache • non-volatile cache • mainly used for editing/creating complex objects • allows for "unsaved" states • the code responsible for the object is responsible for clearing the cache
  • 17. Contexts • Packages objects into re-usable contexts • Most often used with url args, similar to menu loader wildcards • Contexts can be fetched from any condition (url,  • Contexts can be added manually (page manager)
  • 18. Content • re-usable content displays • configurable options • make use of contexts • panels panes are “content” plugins
  • 19. Form Wizard • Form wizard • multi-step forms, different from core multistep • separate forms, vs a single form (the core forms api) • very easy to add new forms (steps), re- order steps
  • 20. CSS Tools • disassemble CSS • filter by properties/values • reassemble CSS • compress CSS
  • 21. Dependent Fields • Provides a simple mechanism for "dependent" form fields • Form fields can be dependent on other fields • Usually dependent on the value of a checkbox, radio button or select
  • 22. Dependent Fields • On any form item, add • '#process' => array('ctools_dependent_process') • '#dependency' => array('id-of-form- without-the-#' => array(list, of, values, that, make, this, gadget, visible)) •
  • 23. Drop-down links • Dropdown menu links • javascript based dropdowns • panels "cogs" • theme('ctools_dropdown', ...)