You are here

function bundle_clone_admin_submit in bundle clone 7

File

./bundle_clone.clone.inc, line 54

Code

function bundle_clone_admin_submit(&$form, &$form_state) {
  $config = (object) $form_state['values']['config'];
  foreach ($config->targets as $target => $ignore) {
    $config->target = $target;
    $source = $config->source;
    $bundles = $config->bundles;
    $holders = array(
      '!source' => l($bundles[$source]['label'], $bundles[$source]['admin']['real path']),
      '!target' => l($bundles[$target]['label'], $bundles[$target]['admin']['real path']),
    );
    drupal_set_message(t('Cloning !source into !target', $holders));
    unset($form_state['values']['fields']['all']);
    $fields = array_keys($form_state['values']['fields']);
    bundle_clone_clone($config, $fields);
  }
}