You are here

function domain_node_import_defaults in Node import 6

Implementation of hook_node_import_defaults().

File

supported/domain/domain.inc, line 51
Support file for the Domain access.

Code

function domain_node_import_defaults($type, $defaults, $fields, $map) {
  $form = array();
  if (($node_type = node_import_type_is_node($type)) !== FALSE) {
    global $_domain;
    $options = array();
    foreach (domain_domains() as $data) {

      // Cannot pass zero in checkboxes.
      $data['domain_id'] == 0 ? $key = -1 : ($key = $data['domain_id']);

      // The domain must be valid.
      if ($data['valid'] || user_access('administer domains')) {
        $options[$key] = $data['sitename'];
      }
    }
    $form['domain_site'] = array(
      '#type' => 'checkbox',
      '#title' => t('Send to all affiliates'),
      '#required' => FALSE,
      '#description' => t('Select if this content can be shown to all affiliates.  This setting will override the options below.'),
      '#default_value' => 0,
    );
    $form['domains'] = array(
      '#type' => 'checkboxes',
      '#title' => t('Publish to'),
      '#options' => $options,
      '#required' => FALSE,
      '#description' => t('Select which affiliates can access this content.'),
      '#default_value' => array(
        $_domain['domain_id'] == 0 ? -1 : $_domain['domain_id'],
      ),
    );
  }
  return $form;
}