the chaos tools suite

17

Click here to load reader

Upload: merlinofchaos

Post on 27-May-2015

19.538 views

Category:

Business


5 download

DESCRIPTION

DrupalCon Paris 2009 presentation on the Chaos Tools Suite for Drupal

TRANSCRIPT

Page 1: The Chaos Tools Suite

The Chaos Tools Suite

DrupalCon Paris, Sep 2009

Page 2: The Chaos Tools Suite

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

• Form wizards• AJAX• Modals• Exportables• Collapsible DIV• CSS caching and sanitization• Plugins

Page 4: The Chaos Tools Suite

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
Page 6: The Chaos Tools Suite
Page 7: The Chaos Tools Suite
Page 8: The Chaos Tools Suite

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

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

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

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
Page 13: The Chaos Tools Suite
Page 14: The Chaos Tools Suite
Page 15: The Chaos Tools Suite

Collapsible DIV

Page 16: The Chaos Tools Suite
Page 17: The Chaos Tools Suite

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.