You are here

function patterns_import_source in Patterns 6.2

Same name and namespace in other branches
  1. 5 patterns.module \patterns_import_source()
  2. 6 patterns.module \patterns_import_source()
  3. 7.2 includes/forms/import.inc \patterns_import_source()
  4. 7 includes/forms/import.inc \patterns_import_source()

Display the import pattern form

2 string references to 'patterns_import_source'
drush_patterns_import in ./patterns.drush.inc
Imports the specified patterns file
patterns_menu in ./patterns.module
Implementation of hook_menu().

File

./patterns.module, line 218
Enables extremely simple adding/removing features to your site with minimal to no configuration

Code

function patterns_import_source(&$form_state) {
  if (empty($form_state['post'])) {
    drupal_set_message(t('Import feature currently supports only XML file format.'), 'warning');
  }
  $form['xmlname'] = array(
    '#type' => 'textfield',
    '#title' => t('Pattern Identifier'),
    '#description' => t('Machine readable name for the pattern. The actual title should be included in the pattern itself.'),
    '#required' => true,
  );
  $form['xmlsource'] = array(
    '#type' => 'textarea',
    '#rows' => 15,
    '#title' => t('Enter Pattern Source Code'),
    '#description' => t('Imported patterns are not executed until you run them manually.'),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Import'),
  );
  $form['#validate'][] = 'patterns_import_validate';
  $form['#submit'][] = 'patterns_import_submit';
  return $form;
}