Patterns Exporter

Events happening in the community are now at Drupal community events on www.drupal.org.
ademarco's picture

Hi all,

in the documentation I've read that somebody is already working on a way to export patterns directly from forms and pages. Can I have more information about it? I haven't found anything on Drupal, is it possible to follow the development and/or to contribute?

Thanks,

Antonio

Comments

Hi Antonio, Work on patterns

vaish's picture

Hi Antonio,

Work on patterns exporter unfortunately got delayed and that's the reason why you couldn't find more details about it or any code samples. It's still high priority for us but I can't really tell when you can expect to see more progress on it. Your help and contribution is very much welcomed. Do you have any particular ideas in mind?

Vaish

Hi Vaish, thank you for your

ademarco's picture

Hi Vaish,

thank you for your reply, I've been looking at the patterns code and here is my idea how patterns export could be handled:

  • Extension of hook_patterns(): we can add an operation called 'exports' which maps the forms the hook can export to functions that can handle it. Here is how it could look like:
    function profile_patterns($op, $id = null, &$data = null) {
      switch($op) {
        ...
        case 'export':
          return array(
            'profile_field_form' => 'profile_patterns_export_field_form',
          );
        ...
      }
    }

    Patterns module will then add an "Export" button/link in the supported forms using hook_form_alter(); clicking "Export" will invoke the respective handling function (in this case profile_patterns_export_field_form()). Or we could also create hook_patterns_export() for this very case.
  • Patterns export handlers: in this case profile_patterns_export_field_form(); it will load the programmatically the form retrieving all its fields' values. The function will then map field values with the patterns XML tags that the importer expects to find.
  • Export management page: for a faster usage we could provide a way to export all the forms by listing them in one single page.

I have just had a really quick look to the module's code, could this be a way to implement the export functionality?

I am working on a way to

manuelBS's picture

I am working on a way to record patterns over the UI, too. My first approach was to use the macro module and macro code module to record form submissions and write an export module for macro to export as patterns XML. What is your approach for a pattern exporter? Should we merge?

Patterns

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: