You are here

views_bookmark.inc in Activity 5

File

includes/views_bookmark.inc
View source
<?php

/**
 * Activity definition file
 *
 * This defines what hooks activity module should use
 */
function views_bookmark_activity_info() {
  $token_types = array();
  $types = views_bookmark_get_bookmarks();
  if ($types) {
    foreach ($types as $type) {
      $token_types[$type->vbid] = $type->title;
    }
  }
  return array(
    'name' => 'views_bookmark_api',
    'module' => 'views_bookmark',
    'ops' => array(
      'mark',
      'unmark',
    ),
    'types' => $token_types,
    'tokens' => array(
      'user-id' => 'user who bookmarked',
      'user-link' => 'a link to the user\'s profile',
      'node-id' => 'id of what was bookmarked',
      'node-title' => 'title of what was bookmarked',
      'node-title-link' => 'link to what was bookmarked',
      'node-type' => 'type of node that was bookmarked',
    ),
  );
}

/**
 * Implementation of hook_views_bookmark_api()
 */
function activity_views_bookmark_api() {
  global $user;
  $args = func_get_args();
  $type = $args[1];
  $action = $args[0];
  $node = node_load($args[3]);
  $account = user_load(array(
    'uid' => $args[2],
  ));
  $tokens = array(
    'user-id' => $args[2],
    'user-name' => $account->name,
    'node-id' => $args[3],
    'node-title' => $node->title,
    'node-type' => $node->type,
  );
  activity_insert('views_bookmark', $type, $action, $tokens);
}

Functions

Namesort descending Description
activity_views_bookmark_api Implementation of hook_views_bookmark_api()
views_bookmark_activity_info Activity definition file