Ctools presentation
Upcoming SlideShare
Loading in...5
×
 

Ctools presentation

on

  • 4,408 views

 

Statistics

Views

Total Views
4,408
Views on SlideShare
4,366
Embed Views
42

Actions

Likes
9
Downloads
82
Comments
0

5 Embeds 42

http://www.digitaria.com 28
http://dfordrupal.com 9
http://www.dfordrupal.com 2
https://twitter.com 2
http://staging.digitaria.devlinux4.digitaria.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

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

    Ctools presentation Ctools presentation Presentation Transcript

    • 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 codeBuilt in export/import functionality
    • Advantages of ExportablesPortability of configuration settingsAllows configuration to use version controlAllows override/revert functionalityAvoids loading data from databaseAllows 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 Dont 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 ResponderAjax without javascriptPart of “core” in Drupal 7Much simpler than AHAHFails gracefully automaticallySEO 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 CommandsCommand 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 Commands11 settings 612 data13 redirect14 reload15 submit
    • What is Ctools? “An API to make multi-step forms much easier.”03 Form Wizard
    • Advantages of Form WizardMultistep forms are hard in DrupalMore like FAPIAllows for better organization of UIAllows for better organization of code
    • hook_menu callback form_demo.moduleAdd required wizard and cache includesSetup multistep array, form settings, callbacks, Labels and IDsLoad form from cacheRender 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 DialogModal popup without javascriptStandardized way of creating modalBuild to handle formsEasy 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
    • ReferencesExportables:  http://drupal.org/node/928026Ajax Responder:  http://zroger.com/node/30Multistep forms:  http://www.nicklewis.org/using-chaos-tools-form-wizard- build-multistep-forms-drupal-6Modal dialog  http://zroger.com/node/31