You are here

function user_relationshipsactivity_activity_info in Activity 6

Same name and namespace in other branches
  1. 5.4 contrib/user_relationshipsactivity/user_relationshipsactivity.module \user_relationshipsactivity_activity_info()
  2. 5.3 contrib/user_relationshipsactivity/user_relationshipsactivity.module \user_relationshipsactivity_activity_info()

Activity definition file

This defines what hooks activity module should use

File

contrib/user_relationshipsactivity/user_relationshipsactivity.module, line 8

Code

function user_relationshipsactivity_activity_info() {
  $types = user_relationships_types_load();
  foreach ($types as $type) {
    $type_admin_name = preg_replace('/\\s/', '_', drupal_strtolower($type->name));
    $token_types[$type_admin_name] = $type->name;
  }
  if (count($token_types) == 0) {
    drupal_set_message(t('There are no relationships currently defined. Please define some <a href="@user_relationships">user relationship</a> types before configuring User Relationship activity messages.', array(
      '@user_relationships' => url('admin/user/relationships'),
    )));
    return FALSE;
  }
  return array(
    'ops' => array(
      'requested' => t('Requested'),
      'approved' => t('Approved'),
      'denied' => t('Denied'),
      'canceled' => t('Canceled'),
      'deleted' => t('Deleted'),
    ),
    'types' => $token_types,
    'roles' => array(
      // This is what corresponds to ACTIVITY_ALL
      'all' => array(
        '#name' => t('All (approved relationships only)'),
        '#description' => t('The general public.'),
        '#default' => array(
          'approved' => t('[author-all] is now [relationship-plural] with [requestee-all]'),
          'deleted' => t('[author-all] is no longer [relationship-plural] with [requestee-all]'),
        ),
      ),
      'requester' => array(
        '#name' => t('Requester'),
        '#description' => t('The person who initiated the relationship.'),
        '#default' => array(
          'requested' => t('[author] requested to be [relationship-plural] with [requestee]'),
          'approved' => t('[requestee] approved the request to be [relationship-plural] with [author]'),
          'denied' => t('[requestee] denied the request to be [relationship-plural] with [author]'),
          'canceled' => t('[author] cancelled the request to be [relationship-plural] with [requestee]'),
          'deleted' => t('[author] [is-are] no longer [relationship-plural] with [requestee]'),
        ),
      ),
      'requestee' => array(
        '#name' => t('Requestee'),
        '#description' => t('The person with whom a relationship has been requested or created.'),
        '#default' => array(
          'requested' => t('[author] requested to be [relationship-plural] with [requestee]'),
          'approved' => t('[requestee] approved the request to be [relationship-plural] with [author]'),
          'denied' => t('[requestee] denied the request to be [relationship-plural] with [author]'),
          'canceled' => t('[author] cancelled the request to be [relationship-plural] with [requestee]'),
          'deleted' => t('[author] [is-are] no longer [relationship-plural] with [requestee]'),
        ),
      ),
    ),
  );
}