O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.

The Chaos Tools Suite

21.287 visualizações

Publicada em

DrupalCon Paris 2009 presentation on the Chaos Tools Suite for Drupal

Publicada em: Negócios, Tecnologia
  • Seja o primeiro a comentar

The Chaos Tools Suite

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

×