function certificate_update_node_mappings in Certificate 3.x
Same name and namespace in other branches
- 8.3 certificate.module \certificate_update_node_mappings()
- 6.2 certificate.module \certificate_update_node_mappings()
- 6 certificate.module \certificate_update_node_mappings()
- 7.3 certificate.module \certificate_update_node_mappings()
- 7.2 certificate.module \certificate_update_node_mappings()
Submit handler to update mappings.
4 calls to certificate_update_node_mappings()
- CertificateTestCase::testCertificateMapping in ./
certificate.test - CertificateTestCase::testCertificateTemplates in ./
certificate.test - Test certicificate templating and tokens.
- certificate_node_update in ./
certificate.module - Implementation of hook_node_update().
- certificate_settings_form_submit in ./
certificate.admin.inc - Save the certificate mappings. For global mappings, we use node ID zero to store it in the database.
File
- ./
certificate.module, line 331 - Certificate module.
Code
function certificate_update_node_mappings($nid, array $node_settings = NULL) {
if (is_array($node_settings)) {
db_delete('certificate_node')
->condition('nid', $nid)
->execute();
foreach ($node_settings as $mapper => $values) {
foreach (array_filter($values) as $match => $cert_nid) {
$record = array(
'nid' => $nid,
'mapper' => $mapper,
'type' => $match,
'template' => $cert_nid,
);
drupal_write_record('certificate_node', $record);
}
}
}
}