You are here

function metatag_config_save in Metatag 7

Save a metatag configuration record to the database.

30 calls to metatag_config_save()
MetatagCoreImageTest::testConfigAbsoluteURL in tests/MetatagCoreImageTest.test
Confirm images can be added to a global config with its absolute URL.
MetatagCoreImageTest::testConfigDrupalRelativeURL in tests/MetatagCoreImageTest.test
Confirm images can be added to a global config using its relative URL.
MetatagCoreImageTest::testConfigImageWithSpaceInURL in tests/MetatagCoreImageTest.test
Confirm images with a space in its URL will be handled properly.
MetatagCoreImageTest::testConfigInternalURL in tests/MetatagCoreImageTest.test
Confirm images can be added to a global config with its internal URI.
MetatagCoreImageTest::testConfigProtocolRelativeURL in tests/MetatagCoreImageTest.test
Confirm images can be added to a global config w its protocol-relative URL.

... See full list

File

./metatag.module, line 522
Primary hook implementations for Metatag.

Code

function metatag_config_save($config) {
  $config->is_new = empty($config->cid);

  // Allow modules to alter the configuration before it is saved using
  // hook_metatag_config_presave().
  module_invoke_all('metatag_config_presave', $config);
  if ($config->is_new) {
    drupal_write_record('metatag_config', $config);

    // Allow modules to act upon the record insertion using
    // hook_metatag_config_insert().
    module_invoke_all('metatag_config_insert', $config);
  }
  else {
    drupal_write_record('metatag_config', $config, array(
      'cid',
    ));

    // Allow modules to act upon the record update using
    // hook_metatag_config_insert().
    module_invoke_all('metatag_config_update', $config);
  }
  unset($config->is_new);

  // Clear any caches.
  metatag_config_cache_clear();
}