You are here

function agreement_type_save in Agreement 7.2

Save an agreement type.

Parameters

array $info: The agreement type info.

bool $rebuild_menu: (Optional) Rebuilds the menu cache.

Return value

array The agreement type that was saved after setting static cache.

8 calls to agreement_type_save()
AgreementCustomUnprivilegedUserTestCase::testAgreement in ./agreement.test
Tests the agreement page only on the front page.
AgreementCustomUnprivilegedUserTestCase::testAgreementDestination in ./agreement.test
Tests the agreement destination functionality.
AgreementCustomUnprivilegedUserTestCase::testAgreementFrequency in ./agreement.test
Tests the agreement frequency setting.
agreement_settings_form_submit in ./agreement.admin.inc
Agreement settings form submit callback.
agreement_type_reset_form_submit in ./agreement.admin.inc
Reset agreement type form submit.

... See full list

File

./agreement.module, line 272
Agreement module code - agreement.module.

Code

function agreement_type_save($info, $rebuild_menu = FALSE) {
  $new = (object) $info;
  $new->settings = serialize($new->settings);
  if (isset($new->id)) {
    drupal_write_record('agreement_type', $new, array(
      'id',
    ));
  }
  else {
    drupal_write_record('agreement_type', $new);
  }

  // When a user changes the URL of the page the menu will need to be rebuilt.
  // Submitting the form lands the user right back here. This will also reset
  // the static cache as built in hook_menu().
  if ($rebuild_menu) {
    menu_rebuild();
  }

  // Prevent multiple static cache reset when menu is rebuilt, but do reset the
  // cache when menu is not rebuilt.
  return agreement_type_load($new->name, !$rebuild_menu);
}