You are here

function favorites_order_callback in Favorites 7.2

Update favorites order weight.

Parameters

$fid: A favorite object.

$weight: A new favorite weight.

1 string reference to 'favorites_order_callback'
favorites_menu in ./favorites.module
Implements hook_menu().

File

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

Code

function favorites_order_callback($fid = NULL, $weight = NULL) {
  if (!empty($fid) && !empty($weight)) {
    db_update('favorites')
      ->fields(array(
      'weight' => $weight,
    ))
      ->condition('fid', $fid)
      ->execute();
    echo $fid;
    echo ':';
    echo $weight;
    drupal_json_output(array(
      'success' => TRUE,
    ));
    return;
  }
  drupal_json_output(array(
    'success' => FALSE,
    'error' => TRUE,
  ));
}