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

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Leveraging the Chaos tool suite for module development

4,669
views

Published on

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.

Published in: Technology

0 Comments
9 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
4,669
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
65
Comments
0
Likes
9
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

























  • 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', ...)

    ×