I'm trying to migrate from existing Drupal 7 sites where access to a node is controlled by the Taxonomy Access module, using a vocab called 'visibility' to a site using Domain Access where I have created a custom field called 'visibility'. migrate_d2d works really well in transferring the node data across, but how do I set it up to transfer the visibility term data in the old site to the visibility field in the new site? There are 2 terms 'public' and 'private' in the original drupal site and two options in the visibility field ('public' and 'private')
I need to get my head around how migrate and migrate_d2d work and what I can do in my custom module to achieve this, but any pointers would be most welcome!
Here is a snippet from my custom module that creates the domain visibility field on the node form:
function domain_custom_form_alter(&$form, &$form_state, $form_id) {
// Apply to all node editing forms only.
if (empty($form['#node_edit_form'])) {
return;
}
if (!empty($form['#node']->nid)) {
$default_visibility_result = db_query("SELECT domain_visibility,domain_id FROM {domain_visibility} WHERE nid = :nid", array(':nid' => $form['#node']->nid))->fetchAll();
}
$current_domain= domain_get_domain();
if (isset($default_visibility_result[0])) {
$default_visibility= $default_visibility_result[0]->domain_visibility;
$default_domain_id= $default_visibility_result[0]->domain_id;
} else {
$default_visibility= 'private';
$default_domain_id = $current_domain['domain_id'];
}
$options['private']= t('Members of this website only');
$options['public']= t('Public - visible to anyone on this website');
$form['visibility'] = array(
'#type' => 'fieldset',
'#access' => TRUE,
'#title' => 'Visibility',
'#description' => t('Who can access this content?'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#group' => 'additional_settings',
'#weight' => 0,
'domain_visibility' => array(
'#type' => 'radios',
'#title' => t('Visible to'),
'#options' => $options,
'#default_value' => $default_visibility,
'#description' => t('Select who the content is visible to')
),
'domain_id' => array(
'#type' => 'value',
'#value' => $default_domain_id,
),
);
}
Also posted to Drupal Answers