SlideShare a Scribd company logo
What is Ctools?

 “This suite is primarily a set of APIs and tools to improve the
                     developer experience”




         Controlling the Chaos
What is Ctools?
 1   Exportables       6 Contexts


 2   Ajax Responder    7   Plugins


 3   Form Wizard       8   Dependant



 4   Modal dialog      9 Content


 5   Object Caching   10 Form tools
What is Ctools?

 “Tools to make it easier for modules to have objects that
 live in database or live in code, such as 'default views'.”




01     Exportables
What is Ctools?

 “Tools to make it easier for the server to handle AJAX
 requests and tell the client what to do with them.”




02     AJAX Responder
What is Ctools?

 “An API to make multi-step forms much easier.”




03     Form Wizard
What is Ctools?

 “Tool to make it simple to put a form in a modal dialog.”




04     Modal Dialog
What is Ctools?

 “Tool to make it easier to edit an object across multiple
 page requests and cache the editing work.”




05      Object Caching
What is Ctools?

 “The notion of wrapping objects in a unified wrapper and
 providing an API to create and accept these contexts as
 input.”




06     Contexts
What is Ctools?

 “Tools to make it easy for modules to let other modules
 implement plugins from .inc files.”




07     Plugins
What is Ctools?

 “A simple form widget to make form items appear and
 disappear based upon the selections in another item.”




08     Dependant
What is Ctools?

 “Pluggable content types used as panes in Panels and
 other modules like Dashboard.”




09     Content
What is Ctools?

 “Tools to make it easier for forms to deal with AJAX.”




10     Form Tools
What is Ctools?

 “Tools to make it easier for modules to have objects that
 live in database or live in code, such as 'default views'.”




11      Exportables
What are Exportables?
A standardized way to define “configuration presets”.

Can be stored in the database or in code

Built in export/import functionality
Advantages of Exportables
Portability of configuration settings

Allows configuration to use version control

Allows override/revert functionality

Avoids loading data from database

Allows for Drush and Features integration
Using Exportables




    Setup your project
Implement hook_schema
                exportable_demo.install
Implement hook_schema      exportable_demo.install




    Export section is unique to exportables
Implement hook_install           module.install




    Don't forget to call hook_install
Define the UI              exportable_demo.module




    Use Ctools plugins to define the UI
Define the UI
/plugin/export_ui/exportable_demo_ctools_export_ui.inc
Define the UI
/plugin/export_ui/exportable_demo_ctools_export_ui.inc
Default Presets             exportable_demo.module




     Tell Ctools that we support our default presets
Default Presets            exportable_demo.module




     Define the actual preset
3 Party Module Presets
 rd
                             third_party.module




      Tell Ctools that we support our default presets
3 Party Module Presets
 rd
                            third_party.module




      Define the actual preset
What is Ctools?

 “Tools to make it easier for the server to handle AJAX
 requests and tell the client what to do with them.”




02     AJAX Responder
Advantages Ajax Responder
Ajax without javascript

Part of “core” in Drupal 7

Much simpler than AHAH

Fails gracefully automatically

SEO Compatible
Using Ajax Responder          ajax_demo.module




    Define the AJAX callback
Using Ajax Responder          ajax_demo.module




    Requires two hook_menu items
Using Ajax Responder   ajax_demo.module




    Add a link
Ajax Responder Commands
Command functions all take the form:


ctools_ajax_command_[COMMAND_NAME]




        Ajax in php
Ajax Responder Commands
 1   replace     6 remove


 2   prepend     7 changed


 3   append      8 alert


 4 after         9 css


 5 before       10 attr
Ajax Responder Commands
11   settings    6


12   data



13   redirect



14 reload


15 submit
What is Ctools?

 “An API to make multi-step forms much easier.”




03     Form Wizard
Advantages of Form Wizard
Multistep forms are hard in Drupal

More like FAPI

Allows for better organization of UI

Allows for better organization of code
hook_menu callback                            form_demo.module
Add required wizard and cache includes

Setup multistep array, form settings, callbacks, Labels and IDs

Load form from cache

Render the actual form




        This is the hardest part
hook_menu callback                form_demo.module




       Add wizard and cache includes
hook_menu callback
                 form_demo.module - form_demo_page()




    Multistep array: form settings
hook_menu callback
                 form_demo.module - form_demo_page()




    Multistep array: form IDs and labels
hook_menu callback
               form_demo.module - form_demo_page()




    Setup form cache
hook_menu callback
               form_demo.module - form_demo_page()




    Render the form
Define form step 1             form_demo.module




    Just a normal hook_form
Define form step 1              form_demo.module




    Normal hook_form_validate too!
Define form step 1              form_demo.module




    Not quite a normal hook_form_submit
Define form step 2                form_demo.module




    Use choices from step 1 in step 2
Define form step 2              form_demo.module




    Not quite a normal hook_form_submit
Define form step 2                 form_demo.module




    Even in last submit, dont' save
Define form callbacks             form_demo.module




    Finish Callback – finally we can save
Define form callbacks                form_demo.module




    Next callback – set the cache
Define form callbacks   form_demo.module




    Cancel callback
Define form callbacks            form_demo.module




    Used for passing data between steps
What is Ctools?

 “Tool to make it simple to put a form in a modal dialog.”




04     Modal Dialog
Advantages Modal Dialog
Modal popup without javascript

Standardized way of creating modal

Build to handle forms

Easy to theme
Implement hook_menu           modal_demo.module




    Two menu items, page and modal
hook_menu callback                 modal_demo.module




    Add js libraries and create link
hook_menu callback                   modal_demo.module




       Create Modal with any form
Modal dialog theming           modal_demo.module




    Add an array of settings
Modal dialog theming     modal_demo.module




    More modal options
Modal dialog theming             Ctools-ajax-sample.js




    Must be in Drupal.theme.prototype namespace
References
Exportables:
    http://drupal.org/node/928026



Ajax Responder:
    http://zroger.com/node/30



Multistep forms:
   http://www.nicklewis.org/using-chaos-tools-form-wizard-

      build-multistep-forms-drupal-6

Modal dialog
   http://zroger.com/node/31

More Related Content

PPTX
Jsf presentation
ODP
A Complete Tour of JSF 2
PDF
Jsf intro
PPT
JSF Component Behaviors
PPTX
Introduction to JSF
PPT
PDF
當ZK遇見Front-End
PDF
Java server faces
Jsf presentation
A Complete Tour of JSF 2
Jsf intro
JSF Component Behaviors
Introduction to JSF
當ZK遇見Front-End
Java server faces

What's hot (20)

PPT
JSF basics
PPT
Struts Introduction Course
ODP
Design Patterns in ZK: Java MVVM as Model-View-Binder
PPTX
Introduction to jsf 2
PDF
Create an application with ember
PDF
Yii - Next level PHP Framework von Florian Facker
PDF
Securing JSF Applications Against the OWASP Top Ten
PPTX
Java server faces
PDF
What You Need To Build Cool Enterprise Applications With JSF
PDF
Introduction Yii Framework
PPTX
IntelliJ IDEA Plugin Development
PDF
Oracle EBS 12.1.3 : Integrate OA Framework BC4J components within java concur...
PPT
Angular 8
PPTX
Better User Experience with .NET
PDF
JEE Programming - 02 The Containers
PPTX
Using Page Objects
PPTX
Advanced java lab swing mvc awt
PDF
Building richwebapplicationsusingasp
PDF
Lecture 10 - Java Server Faces (JSF)
JSF basics
Struts Introduction Course
Design Patterns in ZK: Java MVVM as Model-View-Binder
Introduction to jsf 2
Create an application with ember
Yii - Next level PHP Framework von Florian Facker
Securing JSF Applications Against the OWASP Top Ten
Java server faces
What You Need To Build Cool Enterprise Applications With JSF
Introduction Yii Framework
IntelliJ IDEA Plugin Development
Oracle EBS 12.1.3 : Integrate OA Framework BC4J components within java concur...
Angular 8
Better User Experience with .NET
JEE Programming - 02 The Containers
Using Page Objects
Advanced java lab swing mvc awt
Building richwebapplicationsusingasp
Lecture 10 - Java Server Faces (JSF)
Ad

Similar to Ctools presentation (20)

KEY
Leveraging the Chaos tool suite for module development
ODP
DrupalCafe7 CTools AJAX responder
PPTX
The Chaos Tools Suite
PDF
2007 Fsoss Drupal Under The Hood
PPT
Drupal 6 in a nutshell
ODP
DrupalCafe Kyiv CTools
PDF
Drupal & javascript
ODP
Drupal camp donetsk c tools
PPTX
Drupal & AJAX. Drupalcamp Finland 2010
KEY
PDF
Add-On Development: EE Expects that Every Developer will do his Duty
PDF
presentation
PPT
CTools – toolbox for developers. Yuri Gerasimov.
PDF
presentation
PDF
Add-On Development: EE Expects that Every Developer will do his Duty
PDF
Drupal Render API
PDF
Intro to drupal_7_architecture
PPTX
Drupal Camp Porto - Developing with Drupal: First Steps
PDF
Drupal Front End PHP
PDF
Learning PHP for Drupal Theming, DC Chicago 2009
Leveraging the Chaos tool suite for module development
DrupalCafe7 CTools AJAX responder
The Chaos Tools Suite
2007 Fsoss Drupal Under The Hood
Drupal 6 in a nutshell
DrupalCafe Kyiv CTools
Drupal & javascript
Drupal camp donetsk c tools
Drupal & AJAX. Drupalcamp Finland 2010
Add-On Development: EE Expects that Every Developer will do his Duty
presentation
CTools – toolbox for developers. Yuri Gerasimov.
presentation
Add-On Development: EE Expects that Every Developer will do his Duty
Drupal Render API
Intro to drupal_7_architecture
Drupal Camp Porto - Developing with Drupal: First Steps
Drupal Front End PHP
Learning PHP for Drupal Theming, DC Chicago 2009
Ad

More from Digitaria (6)

PDF
Creating Goals in Google Analytics
PDF
If Content is King, Who is Sheriff?
PDF
Mobile As a Product, Not a Website
PDF
Drupal SEO
PDF
Performance scalability brandonlyon
PDF
Digital Convergence...Are You Ready?
Creating Goals in Google Analytics
If Content is King, Who is Sheriff?
Mobile As a Product, Not a Website
Drupal SEO
Performance scalability brandonlyon
Digital Convergence...Are You Ready?

Recently uploaded (20)

PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Empathic Computing: Creating Shared Understanding
PDF
Machine learning based COVID-19 study performance prediction
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
Big Data Technologies - Introduction.pptx
PDF
cuic standard and advanced reporting.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Approach and Philosophy of On baking technology
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPT
Teaching material agriculture food technology
Understanding_Digital_Forensics_Presentation.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
The AUB Centre for AI in Media Proposal.docx
Spectral efficient network and resource selection model in 5G networks
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Reach Out and Touch Someone: Haptics and Empathic Computing
Empathic Computing: Creating Shared Understanding
Machine learning based COVID-19 study performance prediction
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Big Data Technologies - Introduction.pptx
cuic standard and advanced reporting.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
Approach and Philosophy of On baking technology
Encapsulation_ Review paper, used for researhc scholars
Chapter 3 Spatial Domain Image Processing.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Review of recent advances in non-invasive hemoglobin estimation
Teaching material agriculture food technology

Ctools presentation