You are here

function hook_icon_bundle_save_alter in Icon API 7

Same name and namespace in other branches
  1. 8 icon.api.php \hook_icon_bundle_save_alter()

Allow extensions to alter the bundle record before saving it to the database.

1 invocation of hook_icon_bundle_save_alter()
icon_bundle_save in ./icon.module
Save an icon bundle in the {icon_bundle} table.

File

./icon.api.php, line 181
icon.api.php Hooks and form elements provided by the Icon API module.

Code

function hook_icon_bundle_save_alter(&$bundle) {
  if ($bundle['name'] === 'my_bundle' || $bundle['provider'] === 'my_provider') {

    // Rename the bundle, this would effectively clone an existing bundle.
    // Warning: make sure you don't rename to an existing bundle name as this
    // would overwrite/override it.
    $bundle['name'] = 'rename_bundle_machine_name';

    // Set/override bundle settings.
    $bundle['settings']['custom_property'] = 'custom_value';

    // Change the enabled status of the bundle.
    $bundle['status'] = variable_get('my_conditional_variable', 1);
  }
}