You are here

function bundle_copy_clone in Bundle Copy 7.2

Menu callback: present the clone page.

1 string reference to 'bundle_copy_clone'
bundle_copy_menu in ./bundle_copy.module
Implements hook_menu().

File

./bundle_copy.module, line 652
Bundle copy.

Code

function bundle_copy_clone($form, &$form_state, $entity_type = 'node', $bname_validate = 'node_type_load') {
  $bundles = _bundle_copy_bundle_info($entity_type, FALSE);
  $form['bundle'] = array(
    '#title' => 'Source Bundle',
    '#type' => 'select',
    '#options' => $bundles,
    '#default_value' => '',
    '#description' => t('Select the <em>%btype</em> which you want to clone.', array(
      '%btype' => ucfirst($entity_type),
    )),
  );
  $form['name'] = array(
    '#title' => t('New Bundle Name'),
    '#type' => 'textfield',
    '#description' => t('The human-readable name of this %btype type. This text will be displayed as part of the list on the <em>Add new content</em> page. It is recommended that this name begin with a capital letter and contain only letters, numbers, and spaces. This name must be unique.', array(
      '%btype' => ucfirst($entity_type),
    )),
    '#required' => TRUE,
    '#size' => 30,
  );
  $form['type'] = array(
    '#type' => 'machine_name',
    '#maxlength' => 32,
    '#machine_name' => array(
      'exists' => $bname_validate,
    ),
    '#description' => t('A unique machine-readable name for this %btype. It must only contain lowercase letters, numbers, and underscores. This name will be used for constructing the URL of the %node-add page, in which underscores will be converted into hyphens.', array(
      '%node-add' => t('Add new content'),
      '%btype' => ucfirst($entity_type),
    )),
  );
  $form['next'] = array(
    '#type' => 'submit',
    '#value' => t('Clone'),
  );
  $form_state['storage']['entity_type'] = $entity_type;
  return $form;
}