function simplemeta_meta_save in Simple Meta 7
Same name and namespace in other branches
- 6.2 simplemeta.module \simplemeta_meta_save()
Save meta data.
Parameters
object $meta: meta data
1 call to simplemeta_meta_save()
- simplemeta_meta_form_submit_save in ./
simplemeta.module - SimpleMeta form submit callback on save.
File
- ./
simplemeta.module, line 254 - SimpleMeta module.
Code
function simplemeta_meta_save($meta) {
$is_new = !isset($meta->sid) && !simplemeta_meta_load_by_path($meta->path, $meta->language);
$meta->fit = _simplemeta_meta_calculate_fit($meta->path);
$record = clone $meta;
$record->data = serialize($record->data);
if ($is_new) {
$result = drupal_write_record('simplemeta', $record);
if (!empty($record->sid)) {
$meta->sid = $record->sid;
}
module_invoke_all('simplemeta', $meta, 'insert');
}
else {
$result = drupal_write_record('simplemeta', $record, array(
'sid',
));
module_invoke_all('simplemeta', $meta, 'update');
}
return $result;
}