You are here

function patterns_enable_pattern in Patterns 6

Same name and namespace in other branches
  1. 5 patterns.module \patterns_enable_pattern()
  2. 6.2 patterns.module \patterns_enable_pattern()
  3. 7.2 patterns.module \patterns_enable_pattern()
  4. 7 patterns.module \patterns_enable_pattern()
1 string reference to 'patterns_enable_pattern'
patterns_menu in ./patterns.module
Implementation of hook_menu().

File

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

Code

function patterns_enable_pattern(&$form_state, $pid) {
  $form['pid'] = array(
    '#type' => 'value',
    '#value' => $pid,
  );
  $options = array(
    'first-update' => t('only if disabled or if updated since last run (recommended)'),
    'always' => t('always'),
    'update' => t('only if updated since last run'),
    'first' => t('only if disabled'),
    'never' => t("don't run sub-patterns at all"),
  );
  $form['run-subpatterns'] = array(
    '#type' => 'radios',
    '#title' => t('Run sub-patterns:'),
    '#description' => t("Decide when to run sub-patterns that are called by the currently run pattern. If unsure, stick to recommended setting. Note that your choice won't have any effect if your pattern doesn't contain sub-patterns or if this setting has been defined within the pattern file itself."),
    '#options' => $options,
    '#default_value' => 'first-update',
  );
  $disclaimer = t('Please be sure to backup your site before running a pattern. Patterns are not guaranteed to be reversable in case they do not execute well or if unforseen side effects occur.');
  $pattern = patterns_get_pattern($pid);
  return confirm_form($form, t('Proceed with running pattern %pattern?', array(
    '%pattern' => $pattern->title,
  )), 'admin/build/patterns', $disclaimer);
}