function beautytips_manager_save_custom_tip in BeautyTips 6.2
Same name and namespace in other branches
- 8 beautytips_manager/beautytips_manager.module \beautytips_manager_save_custom_tip()
- 7.2 beautytips_manager.module \beautytips_manager_save_custom_tip()
Save a singular beautytip.
1 call to beautytips_manager_save_custom_tip()
- beautytips_manager_admin_submit in ./
beautytips_manager.module - Submission callback for beautytips manager admin form.
File
- ./
beautytips_manager.module, line 343
Code
function beautytips_manager_save_custom_tip($tip) {
$tip = (object) $tip;
// Mysql doesn't let these fields have default values
// in strict mode, so ensure they are at least an empty string.
$text_fields = array(
'content',
'pages',
);
foreach ($text_fields as $field) {
if (!isset($tip->{$field})) {
$tip->{$field} = '';
}
}
if (isset($tip->bid) && $tip->bid) {
drupal_write_record('beautytips_manager', $tip, 'bid');
}
else {
drupal_write_record('beautytips_manager', $tip);
}
return $tip;
}