the chaos tools suite
DESCRIPTION
DrupalCon Paris 2009 presentation on the Chaos Tools Suite for DrupalTRANSCRIPT
![Page 1: The Chaos Tools Suite](https://reader038.vdocuments.mx/reader038/viewer/2022100517/55659867d8b42a0a768b47fc/html5/thumbnails/1.jpg)
The Chaos Tools Suite
DrupalCon Paris, Sep 2009
![Page 2: The Chaos Tools Suite](https://reader038.vdocuments.mx/reader038/viewer/2022100517/55659867d8b42a0a768b47fc/html5/thumbnails/2.jpg)
WTF?
• Considered a sub-core by many.• Not as well-tested as core, but more agile.• I don’t have to argue over shed colors.• Collection of important API tools developed
based upon the needs of Views and Panels.• Starting to get a small cadre of devs who are
helping patch and expand the tools.• Two pieces went into core.
![Page 3: The Chaos Tools Suite](https://reader038.vdocuments.mx/reader038/viewer/2022100517/55659867d8b42a0a768b47fc/html5/thumbnails/3.jpg)
• Form wizards• AJAX• Modals• Exportables• Collapsible DIV• CSS caching and sanitization• Plugins
![Page 4: The Chaos Tools Suite](https://reader038.vdocuments.mx/reader038/viewer/2022100517/55659867d8b42a0a768b47fc/html5/thumbnails/4.jpg)
Form Wizards
• Start off with an array to describe the form• Each step within the form is a completely
independent form.• Uses server side caching to keep data between
steps.• Handles Back, Next, Finish and Cancel buttons
for you.• http://www.nicklewis.org/using-chaos-tools-
form-wizard-build-multistep-forms-drupal-6
![Page 5: The Chaos Tools Suite](https://reader038.vdocuments.mx/reader038/viewer/2022100517/55659867d8b42a0a768b47fc/html5/thumbnails/5.jpg)
![Page 6: The Chaos Tools Suite](https://reader038.vdocuments.mx/reader038/viewer/2022100517/55659867d8b42a0a768b47fc/html5/thumbnails/6.jpg)
![Page 7: The Chaos Tools Suite](https://reader038.vdocuments.mx/reader038/viewer/2022100517/55659867d8b42a0a768b47fc/html5/thumbnails/7.jpg)
![Page 8: The Chaos Tools Suite](https://reader038.vdocuments.mx/reader038/viewer/2022100517/55659867d8b42a0a768b47fc/html5/thumbnails/8.jpg)
Individual steps
• Each step is a normal FAPI form…almost.• The submit handler on each step should build
up data on the $form_state.• No permanent storage should happen here.• Order of steps can be changed during submit
handler by changing $form_state[‘clicked_button’][‘#next’]
![Page 9: The Chaos Tools Suite](https://reader038.vdocuments.mx/reader038/viewer/2022100517/55659867d8b42a0a768b47fc/html5/thumbnails/9.jpg)
AJAX Framework
• Links and forms can be AJAXified by adding classes.
• AJAX callbacks use a macro language to tell the server how to handle the returned data.
• Macro language is extensible so that you can add commands if you need to do something it does not already do.
![Page 10: The Chaos Tools Suite](https://reader038.vdocuments.mx/reader038/viewer/2022100517/55659867d8b42a0a768b47fc/html5/thumbnails/10.jpg)
WTF?• <a href=“/my/ajax/thing” class=“ctools-use-
ajax”>Click to do something ajaxy</a>
ctools_include('ajax'); $commands = array(); $commands[] = ctools_ajax_command_replace('#page-manager-list-pages', $table); if (!empty($replace_form)) { $commands[] = ctools_ajax_command_replace('#page-manager-list-pages-form', $form); } ctools_ajax_render($commands);
![Page 11: The Chaos Tools Suite](https://reader038.vdocuments.mx/reader038/viewer/2022100517/55659867d8b42a0a768b47fc/html5/thumbnails/11.jpg)
CTools Modal
• Builds on the AJAX framework.• Uses ctools-use-modal class to trigger modal
loading.• AJAX framework command to dismiss the
modal: ctools_ajax_modal_dismiss()• Automatically supported by the wizard.inc tool
by adding ‘modal’ => TRUE and ‘ajax’ => TRUE to the form state.
![Page 12: The Chaos Tools Suite](https://reader038.vdocuments.mx/reader038/viewer/2022100517/55659867d8b42a0a768b47fc/html5/thumbnails/12.jpg)
![Page 13: The Chaos Tools Suite](https://reader038.vdocuments.mx/reader038/viewer/2022100517/55659867d8b42a0a768b47fc/html5/thumbnails/13.jpg)
![Page 14: The Chaos Tools Suite](https://reader038.vdocuments.mx/reader038/viewer/2022100517/55659867d8b42a0a768b47fc/html5/thumbnails/14.jpg)
![Page 15: The Chaos Tools Suite](https://reader038.vdocuments.mx/reader038/viewer/2022100517/55659867d8b42a0a768b47fc/html5/thumbnails/15.jpg)
Collapsible DIV
![Page 16: The Chaos Tools Suite](https://reader038.vdocuments.mx/reader038/viewer/2022100517/55659867d8b42a0a768b47fc/html5/thumbnails/16.jpg)
![Page 17: The Chaos Tools Suite](https://reader038.vdocuments.mx/reader038/viewer/2022100517/55659867d8b42a0a768b47fc/html5/thumbnails/17.jpg)
CSS Caching
• Filter CSS from user input to remove dangerous items
• Store generated CSS in temporary files in the files directory. Similar to CSS aggregation.