You are here

function _favorites_save_favorite in Favorites 7

Same name and namespace in other branches
  1. 7.2 favorites.module \_favorites_save_favorite()

Helper function: Store favorites for registered users.

Used to abstract the storage model (cookie vs. db).

Parameters

$values: The sanitized values submitted by the user.

$account: The user account the favorite belongs to. Must be a registered user (uid > 0); no validation is made here.

See also

favorites_add_favorite().

_favorites_save_favorite_db().

_favorites_save_favorite_cookie().

1 call to _favorites_save_favorite()
favorites_add_favorite in ./favorites.module
Add a favorite.

File

./favorites.module, line 394
The favorites module allows users to bookmark any path within a site.

Code

function _favorites_save_favorite($values, $account = NULL) {
  if (!isset($account)) {
    global $user;
    $account = $user;
  }
  if (_favorites_user_storage_db($account)) {
    _favorites_save_favorite_db($values, $account);
  }
  else {
    _favorites_save_favorite_cookie($values);
  }
}