function _cer_hijack_cnr in Corresponding Entity References 7.3
Converts all CNR presets to CER presets, then disables CNR.
2 calls to _cer_hijack_cnr()
- cer_install in ./
cer.install - Implements hook_install().
- cer_update_7005 in ./
cer.install - Creates the {cer_preset} table to store CerPreset entities, and rebuilds legacy presets.
File
- ./
cer.install, line 374 - Install file providing corresponding entity reference schema.
Code
function _cer_hijack_cnr() {
$cnr = db_query('SELECT * FROM {corresponding_node_references} WHERE 1')
->fetchAll();
foreach ($cnr as $index => $preset) {
// Prepend 'node*' to each side of the preset. CNR, sensibly enough, assumes everything
// is on a node, but CER needs this specified explicitly.
$key = explode('*', $preset->node_types_content_fields);
$cnr[$index]->entity_types_content_fields = "node*{$key[0]}*{$key[1]}*node*{$key[2]}*{$key[3]}";
}
array_walk($cnr, '_cer_rebuild_preset');
module_disable(array(
'corresponding_node_references',
));
drupal_set_message(t('Rebuilt CNR presets.'));
}