SlideShare uma empresa Scribd logo
1 de 61
Baixar para ler offline
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

Mais conteúdo relacionado

Mais procurados

Struts Introduction Course
Struts Introduction CourseStruts Introduction Course
Struts Introduction Course
guest764934
 
IntelliJ IDEA Plugin Development
IntelliJ IDEA Plugin DevelopmentIntelliJ IDEA Plugin Development
IntelliJ IDEA Plugin Development
Alexander Zaitsev
 

Mais procurados (20)

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

Semelhante a Ctools presentation

Whmcs addon module docs
Whmcs addon module docsWhmcs addon module docs
Whmcs addon module docs
quyvn
 

Semelhante a Ctools presentation (20)

AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014
 
DrupalCafe Kyiv CTools
DrupalCafe Kyiv CToolsDrupalCafe Kyiv CTools
DrupalCafe Kyiv CTools
 
MVC Training Part 2
MVC Training Part 2MVC Training Part 2
MVC Training Part 2
 
angularJs Workshop
angularJs WorkshopangularJs Workshop
angularJs Workshop
 
AspMVC4 start101
AspMVC4 start101AspMVC4 start101
AspMVC4 start101
 
Asp.Net MVC Intro
Asp.Net MVC IntroAsp.Net MVC Intro
Asp.Net MVC Intro
 
Top 15 most popular drupal 8 modules
Top 15 most popular drupal 8 modulesTop 15 most popular drupal 8 modules
Top 15 most popular drupal 8 modules
 
Working With The Symfony Admin Generator
Working With The Symfony Admin GeneratorWorking With The Symfony Admin Generator
Working With The Symfony Admin Generator
 
ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010
ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010
ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010
 
Whmcs addon module docs
Whmcs addon module docsWhmcs addon module docs
Whmcs addon module docs
 
DrupalCafe7 CTools AJAX responder
DrupalCafe7 CTools AJAX responderDrupalCafe7 CTools AJAX responder
DrupalCafe7 CTools AJAX responder
 
Introduction to Angular Js
Introduction to Angular JsIntroduction to Angular Js
Introduction to Angular Js
 
introduction to Angularjs basics
introduction to Angularjs basicsintroduction to Angularjs basics
introduction to Angularjs basics
 
AngularJS Best Practices
AngularJS Best PracticesAngularJS Best Practices
AngularJS Best Practices
 
Les02
Les02Les02
Les02
 
Features and Context Overview
Features and Context OverviewFeatures and Context Overview
Features and Context Overview
 
Angular - Chapter 3 - Components
Angular - Chapter 3 - ComponentsAngular - Chapter 3 - Components
Angular - Chapter 3 - Components
 
Intland Academy: Requirements Management Training Session | 19 Sep 2019
Intland Academy: Requirements Management Training Session | 19 Sep 2019Intland Academy: Requirements Management Training Session | 19 Sep 2019
Intland Academy: Requirements Management Training Session | 19 Sep 2019
 
MVC ppt presentation
MVC ppt presentationMVC ppt presentation
MVC ppt presentation
 
Getting Started with Zend Framework
Getting Started with Zend FrameworkGetting Started with Zend Framework
Getting Started with Zend Framework
 

Mais de Digitaria (6)

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

Último

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Último (20)

Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 

Ctools presentation