You are here

function rb_cck_action_copy_multiple_form in Rules Bonus Pack 6

Configuration form for 'rb_cck_action_copy_multiple'.

File

./rb_cck.module, line 542
Functions for extending CCK field management with Rules.

Code

function rb_cck_action_copy_multiple_form($settings, &$form) {

  // Get a list of all existing fields in a plain array.
  $fields = rb_cck_get_fields(array(
    'all',
  ));

  // Allow to copy node title, optionally.
  $form['settings']['copy_title'] = array(
    '#type' => 'checkbox',
    '#title' => t('Copy node title as well'),
    '#default_value' => $settings['copy_title'],
  );

  // Allow to skip empty fields, optionally.
  $form['settings']['skip_empty'] = array(
    '#type' => 'checkbox',
    '#title' => t('Skip empty fields'),
    '#default_value' => $settings['skip_empty'],
    '#description' => t('Checking this box will allow preserving existing values
      in the target node, if the corresponding fields in the source node are
      empty.'),
  );

  // Allow to skip selected fields.
  $form['settings']['fields_to_copy'] = array(
    '#type' => 'select',
    '#title' => t('Fields to copy'),
    '#options' => $fields,
    '#multiple' => TRUE,
    '#default_value' => $settings['fields_to_copy'],
    '#description' => t('The content of the selected fields will be copied from
      the source to the target node.'),
  );
}