You are here

function activity_install_activity_defaults in Activity 5.4

Same name and namespace in other branches
  1. 6 activity.module \activity_install_activity_defaults()

Helper function to allow activity contrib modules to set initial default values for token and operation types on module install.

11 calls to activity_install_activity_defaults()
buddylist2activity_install in contrib/buddylist2activity/buddylist2activity.install
Implementation of hook_install().
buddylistactivity_install in contrib/buddylistactivity/buddylistactivity.install
Implementation of hook_install().
commentactivity_install in contrib/commentactivity/commentactivity.install
Implementation of hook_install().
favorite_nodesactivity_install in contrib/favorite_nodesactivity/favorite_nodesactivity.install
Implementation of hook_install().
flagactivity_install in contrib/flagactivity/flagactivity.install
Implementation of hook_install().

... See full list

File

./activity.module, line 890
activity.module

Code

function activity_install_activity_defaults($module) {

  // We're including the activity contrib module file manually as Drupal
  // will not have access to the functions defined in the contrib module
  // at install time.
  require_once drupal_get_path('module', $module) . '/' . $module . '.module';
  $info = call_user_func($module . '_activity_info');
  if ($info) {
    variable_set($module . '_token_types', array_keys($info['types']));
    variable_set($module . '_op_types', array_keys($info['ops']));
    foreach ($info['roles'] as $role_name => $role) {
      foreach ($info['types'] as $type_name => $type) {
        foreach ($info['ops'] as $op_name => $op) {
          $token_field = "{$module}_{$type_name}_{$op_name}_{$role_name}";
          $default = is_array($role['#default']) ? $role['#default'][$op_name] : $role['#default'];
          variable_set($token_field, $default ? $default : '');
        }
      }
    }
  }
}