You are here

function contemplate_save in Content Templates (Contemplate) 6

Same name and namespace in other branches
  1. 5 contemplate.module \contemplate_save()
  2. 7 contemplate.module \contemplate_save()
2 calls to contemplate_save()
contemplate_edit_type_form_submit in ./contemplate.module
contemplate_features_rebuild in includes/contemplate.features.inc

File

./contemplate.module, line 531
Create templates to customize teaser and body content.

Code

function contemplate_save($edit) {
  $type = $edit['values']['type'];
  $teaserfield = !empty($edit['values']['teaserfield']) ? $edit['values']['teaserfield'] : '';
  $bodyfield = !empty($edit['values']['bodyfield']) ? $edit['values']['bodyfield'] : '';
  $rssfield = !empty($edit['values']['rssfield']) ? $edit['values']['rssfield'] : '';
  $enclosure = !empty($edit['values']['enclosure']) ? $edit['values']['enclosure'] : '';
  $flags |= !empty($edit['values']['teaser-enabled']) ? CONTEMPLATE_TEASER_ENABLED : 0;
  $flags |= !empty($edit['values']['body-enabled']) ? CONTEMPLATE_BODY_ENABLED : 0;
  $flags |= !empty($edit['values']['rss-enabled']) ? CONTEMPLATE_RSS_ENABLED : 0;
  contemplate_delete($type);
  $sql = "INSERT INTO {contemplate} (type, teaser, body, rss, enclosure, flags) VALUES ('%s', '%s', '%s', '%s', '%s', %d)";
  return db_query($sql, $type, $teaserfield, $bodyfield, $rssfield, $enclosure, $flags);
}