You are here

function node_clone_action_clone_form in Node clone 8

Action form.

File

./node_clone.module, line 202
Allow users to make a copy of an item of content (a node) and then edit that copy.

Code

function node_clone_action_clone_form($context) {
  $form['clone_context'] = array(
    '#tree' => TRUE,
  );
  $form['clone_context']['prefix_title'] = array(
    '#title' => t('Prefix title'),
    '#type' => 'checkbox',
    '#description' => t('Should cloned node tiles be prefixed?'),
    '#default_value' => isset($context['clone_context']['prefix_title']) ? $context['clone_context']['prefix_title'] : 1,
  );
  $form['clone_context']['substitute_from'] = array(
    '#title' => t('Substitute from string'),
    '#type' => 'textfield',
    '#description' => t('String (or regex) to substitute from in title and body.'),
    '#default_value' => isset($context['clone_context']['substitue_from']) ? $context['clone_context']['substitue_from'] : '',
  );
  $form['clone_context']['substitute_to'] = array(
    '#title' => t('Substitute to string'),
    '#type' => 'textfield',
    '#description' => t('String (or regex) to substitute to in title and body.'),
    '#default_value' => isset($context['clone_context']['substitue_to']) ? $context['clone_context']['substitue_to'] : '',
  );
  $form['clone_context']['substitute_case_insensitive'] = array(
    '#title' => t('Case insensitive substitution'),
    '#type' => 'checkbox',
    '#description' => t('Should the substituion match be case insensitive?'),
    '#default_value' => isset($context['clone_context']['substitute_case_insensitive']) ? $context['clone_context']['substitute_case_insensitive'] : NULL,
  );
  return $form;
}