flag-list--flag-3.x-compatibility.patch 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526
  1. diff --git a/flag_lists.admin.inc b/flag_lists.admin.inc
  2. index a71a11cc511ebba08169b334407985c8f501bc30..71d532209d15f2171dce7d0906131572f22b97b3 100644
  3. --- a/flag_lists.admin.inc
  4. +++ b/flag_lists.admin.inc
  5. @@ -110,7 +110,7 @@ function flag_lists_add_js($type = NULL) {
  6. }
  7. // New flag. Load the template row.
  8. - $query = db_select('flags', 'f');
  9. + $query = db_select('flag', 'f');
  10. $query->leftJoin('flag_lists_types', 'fl', 'f.name = fl.name');
  11. $query->fields('f')
  12. ->fields('fl')
  13. @@ -119,7 +119,7 @@ function flag_lists_add_js($type = NULL) {
  14. $row = $query->execute()
  15. ->fetchObject();
  16. - $newflag = flag_flag::factory_by_content_type('node');
  17. + $newflag = flag_flag::factory_by_entity_type('node');
  18. $flag = $newflag->factory_by_row($row);
  19. // The template fid becomes the flag_lists parent flag.
  20. @@ -243,7 +243,7 @@ function flag_lists_form_submit($form, $form_state, $account = NULL) {
  21. else {
  22. // New flag. Load the template row.
  23. $type = $form_state['values']['type'];
  24. - $query = db_select('flags', 'f');
  25. + $query = db_select('flag', 'f');
  26. $query->leftJoin('flag_lists_types', 'fl', 'f.name = fl.name');
  27. $query->fields('f')
  28. ->fields('fl')
  29. @@ -252,7 +252,7 @@ function flag_lists_form_submit($form, $form_state, $account = NULL) {
  30. $row = $query->execute()
  31. ->fetchObject();
  32. - $newflag = flag_flag::factory_by_content_type('node');
  33. + $newflag = flag_flag::factory_by_entity_type('node');
  34. $flag = $newflag->factory_by_row($row);
  35. // The template fid becomes the flag_lists parent flag.
  36. diff --git a/flag_lists.install b/flag_lists.install
  37. index bd290d10d849d116a8ca68fb6abf0dcc93136f53..a84fd496888fb65c6cdddacaf37828ede23def76 100644
  38. --- a/flag_lists.install
  39. +++ b/flag_lists.install
  40. @@ -30,7 +30,7 @@ function flag_lists_schema() {
  41. 'unsigned' => TRUE,
  42. 'not null' => TRUE,
  43. ),
  44. - 'content_type' => array(
  45. + 'entity_type' => array(
  46. 'type' => 'varchar',
  47. 'length' => '32',
  48. 'not null' => TRUE,
  49. @@ -72,13 +72,13 @@ function flag_lists_schema() {
  50. 'not null' => TRUE,
  51. 'default' => 0,
  52. ),
  53. - 'content_type' => array(
  54. + 'entity_type' => array(
  55. 'type' => 'varchar',
  56. 'length' => '32',
  57. 'not null' => TRUE,
  58. 'default' => '',
  59. ),
  60. - 'content_id' => array(
  61. + 'entity_id' => array(
  62. 'type' => 'int',
  63. 'unsigned' => TRUE,
  64. 'not null' => TRUE,
  65. @@ -106,11 +106,11 @@ function flag_lists_schema() {
  66. ),
  67. 'primary key' => array('fcid'),
  68. 'unique keys' => array(
  69. - 'fid_content_id_uid_sid' => array('fid', 'content_id', 'uid', 'sid'),
  70. + 'fid_entity_id_uid_sid' => array('fid', 'entity_id', 'uid', 'sid'),
  71. ),
  72. 'indexes' => array(
  73. - 'content_type_content_id' => array('content_type', 'content_id'),
  74. - 'content_type_uid_sid' => array('content_type', 'uid', 'sid'),
  75. + 'entity_type_entity_id' => array('entity_type', 'entity_id'),
  76. + 'entity_type_uid_sid' => array('entity_type', 'uid', 'sid'),
  77. ),
  78. );
  79. $schema['flag_lists_counts'] = array(
  80. @@ -122,13 +122,13 @@ function flag_lists_schema() {
  81. 'not null' => TRUE,
  82. 'default' => 0,
  83. ),
  84. - 'content_type' => array(
  85. + 'entity_type' => array(
  86. 'type' => 'varchar',
  87. 'length' => '32',
  88. 'not null' => TRUE,
  89. 'default' => '',
  90. ),
  91. - 'content_id' => array(
  92. + 'entity_id' => array(
  93. 'type' => 'int',
  94. 'unsigned' => TRUE,
  95. 'not null' => TRUE,
  96. @@ -143,10 +143,10 @@ function flag_lists_schema() {
  97. 'disp-width' => '10',
  98. )
  99. ),
  100. - 'primary key' => array('fid', 'content_id'),
  101. + 'primary key' => array('fid', 'entity_id'),
  102. 'indexes' => array(
  103. - 'fid_content_type' => array('fid', 'content_type'),
  104. - 'content_type_content_id' => array('content_type', 'content_id'),
  105. + 'fid_entity_type' => array('fid', 'entity_type'),
  106. + 'entity_type_entity_id' => array('entity_type', 'entity_id'),
  107. 'count' => array('count'),
  108. ),
  109. );
  110. @@ -190,13 +190,13 @@ function flag_lists_install() {
  111. function flag_lists_uninstall() {
  112. // Remove our template flags.
  113. $query = db_select('flag_lists_types', 'fl');
  114. - $query->leftJoin('flags', 'f', 'fl.name = f.name');
  115. + $query->leftJoin('flag', 'f', 'fl.name = f.name');
  116. $query->addField('fl', 'fid', 'fid');
  117. $query->distinct();
  118. $fids = $query->execute();
  119. foreach ($fids as $fid) {
  120. - db_delete('flags')->condition('fid', $fid->fid);
  121. + db_delete('flag')->condition('fid', $fid->fid);
  122. db_delete('flag_content')->condition('fid', $fid->fid);
  123. db_delete('flag_types')->condition('fid', $fid->fid);
  124. db_delete('flag_counts')->condition('fid', $fid->fid);
  125. diff --git a/flag_lists.module b/flag_lists.module
  126. index 8fde9dd12b25e5e82ff79204fd800139460cd7e7..13a5dd77ead6832901a6fb0aac6511c0bc62eb3b 100644
  127. --- a/flag_lists.module
  128. +++ b/flag_lists.module
  129. @@ -214,7 +214,7 @@ function theme_flag_lists_user_list($variables) {
  130. $content = flag_lists_get_flagged_content($fid, $uid);
  131. foreach ($content as $item) {
  132. if ($item->content_type == 'node') {
  133. - $node = node_load($item->content_id);
  134. + $node = node_load($item->entity_id);
  135. $items[] = l($node->title, 'node/' . $node->nid);
  136. }
  137. }
  138. @@ -811,7 +811,7 @@ function flag_lists_set_messages(&$flag) {
  139. *
  140. * Make sure a user can only see his/her own personal flags.
  141. */
  142. -function flag_lists_flag_access($flag, $content_id, $action, $account) {
  143. +function flag_lists_flag_access($flag, $entity_id, $action, $account) {
  144. if (!empty($flag->module) && $flag->module == 'flag_lists') {
  145. switch ($action) {
  146. case 'flag':
  147. @@ -936,7 +936,7 @@ function flag_lists_get_user_flags($content_type = NULL, $account = NULL, $use_f
  148. $query = db_select('flag_lists_flags', 'fl')
  149. ->fields('fl')
  150. ->condition('fl.uid', $account->uid);
  151. - $query->leftJoin('flags', 'f', 'fl.pfid = f.fid');
  152. + $query->leftJoin('flag', 'f', 'fl.pfid = f.fid');
  153. $query->leftJoin('flag_lists_types', 'ft', 'ft.name = f.name');
  154. $query->addField('ft', 'type');
  155. if ($content_type) {
  156. @@ -1011,12 +1011,12 @@ function theme_flag_lists_list($variables) {
  157. // Make sure we have a node.
  158. if (is_object($node) && user_access('create flag lists')) {
  159. $content_type = $node->type;
  160. - $content_id = $node->nid;
  161. + $entity_id = $node->nid;
  162. }
  163. // Or at least confirm we are on a node page and use has access.
  164. elseif (arg(0) == 'node' && is_numeric(arg(1)) && user_access('create flag lists')) {
  165. - $content_id = arg(1);
  166. - $query = db_select('node')->condition('nid', $content_id);
  167. + $entity_id = arg(1);
  168. + $query = db_select('node')->condition('nid', $entity_id);
  169. $query->addField('node', 'type');
  170. $content_type = $query->execute()->fetchField();
  171. }
  172. @@ -1034,19 +1034,19 @@ function theme_flag_lists_list($variables) {
  173. // Build the list of lists for this node.
  174. foreach ($flags as $flag) {
  175. if ($flag->module == 'flag_lists') {
  176. - $action = _flag_lists_is_flagged($flag, $content_id, $user->uid, 0) ? 'unflag' : 'flag';
  177. + $action = _flag_lists_is_flagged($flag, $entity_id, $user->uid, 0) ? 'unflag' : 'flag';
  178. }
  179. else {
  180. - $action = $flag->is_flagged($content_id) ? 'unflag' : 'flag';;
  181. + $action = $flag->is_flagged($entity_id) ? 'unflag' : 'flag';;
  182. }
  183. // Do we need the ops?
  184. if ($ops && $flag->module == 'flag_lists') {
  185. $ops_links = theme('flag_lists_ops', array('flag' => $flag));
  186. - $link = $flag->theme($action, $content_id) . $ops_links;
  187. + $link = $flag->theme($action, $entity_id) . $ops_links;
  188. }
  189. else {
  190. - $link = $flag->theme($action, $content_id);
  191. + $link = $flag->theme($action, $entity_id);
  192. }
  193. // If it's a list, fix the link.
  194. @@ -1201,12 +1201,12 @@ function flag_lists_get_flagged_content($fid, $uid) {
  195. * The full flag object of for the flag link being generated.
  196. * @param $action
  197. * The action this link will perform. Either 'flag' or 'unflag'.
  198. - * @param $content_id
  199. + * @param $entity_id
  200. * The ID of the node, comment, user, or other object being flagged.
  201. * @return
  202. * An array defining properties of the link.
  203. */
  204. -function flag_lists_flag_link($flag, $action, $content_id) {
  205. +function flag_lists_flag_link($flag, $action, $entity_id) {
  206. return array();
  207. }
  208. @@ -1224,30 +1224,61 @@ function flag_lists_flag_link_types() {
  209. function flag_lists_flag_default_flags($name = 'fl_template') {
  210. - return array(
  211. - array(
  212. - 'api_version' => 2,
  213. - 'name' => $name,
  214. - 'module' => 'flag_lists',
  215. - 'content_type' => 'node',
  216. - 'global' => 0,
  217. - 'show_on_page' => 0,
  218. - 'show_on_teaser' => 0,
  219. - 'show_on_form' => 0,
  220. - // The following UI labels aren't wrapped in t() because they are written
  221. - // to the DB in English. They are passed to t() later, thus allowing for
  222. - // multilingual sites.
  223. - 'title' => 'Flag lists template',
  224. - 'flag_short' => 'Add to your [flag_lists:title] [flag_lists:term]',
  225. - 'flag_long' => 'Add this post to your [flag_lists:title] [flag_lists:term]',
  226. - 'flag_message' => 'This post has been added to your [flag_lists:title] [flag_lists:term]',
  227. - 'unflag_short' => 'Remove this from your [flag_lists:title] [flag_lists:term]',
  228. - 'unflag_long' => 'Remove this post from your [flag_lists:title] [flag_lists:term]',
  229. - 'unflag_message' => 'This post has been removed from your [flag_lists:title] [flag_lists:term]',
  230. - 'types' => array(),
  231. - 'link_type' => 'toggle',
  232. - ),
  233. - );
  234. + // return array(
  235. + // array(
  236. + // 'api_version' => 2,
  237. + // 'name' => $name,
  238. + // 'module' => 'flag_lists',
  239. + // 'content_type' => 'node',
  240. + // 'global' => 0,
  241. + // 'show_on_page' => 0,
  242. + // 'show_on_teaser' => 0,
  243. + // 'show_on_form' => 0,
  244. + // // The following UI labels aren't wrapped in t() because they are written
  245. + // // to the DB in English. They are passed to t() later, thus allowing for
  246. + // // multilingual sites.
  247. + // 'title' => 'Flag lists template',
  248. + // 'flag_short' => 'Add to your [flag_lists:title] [flag_lists:term]',
  249. + // 'flag_long' => 'Add this post to your [flag_lists:title] [flag_lists:term]',
  250. + // 'flag_message' => 'This post has been added to your [flag_lists:title] [flag_lists:term]',
  251. + // 'unflag_short' => 'Remove this from your [flag_lists:title] [flag_lists:term]',
  252. + // 'unflag_long' => 'Remove this post from your [flag_lists:title] [flag_lists:term]',
  253. + // 'unflag_message' => 'This post has been removed from your [flag_lists:title] [flag_lists:term]',
  254. + // 'types' => array(),
  255. + // 'link_type' => 'toggle',
  256. + // ),
  257. + // );
  258. +
  259. +$flags = array();
  260. +// Exported flag: "Flag lists template".
  261. +$flags['fl_template'] = array(
  262. + 'entity_type' => 'node',
  263. + 'title' => 'Flag lists template',
  264. + 'global' => 0,
  265. + 'types' => array(),
  266. + 'flag_short' => 'Add to your [flag_lists:title] [flag_lists:term]',
  267. + 'flag_long' => 'Add this post to your [flag_lists:title] [flag_lists:term]',
  268. + 'flag_message' => 'This post has been added to your [flag_lists:title] [flag_lists:term]',
  269. + 'unflag_short' => 'Remove this from your [flag_lists:title] [flag_lists:term]',
  270. + 'unflag_long' => 'Remove this post from your [flag_lists:title] [flag_lists:term]',
  271. + 'unflag_message' => 'This post has been removed from your [flag_lists:title] [flag_lists:term]',
  272. + 'unflag_denied_text' => '',
  273. + 'link_type' => 'toggle',
  274. + 'weight' => 0,
  275. + 'api_version' => 3,
  276. + 'module' => 'flag_lists',
  277. + 'show_on_page' => 0,
  278. + 'show_on_teaser' => 0,
  279. + 'show_on_form' => 0,
  280. + 'status' => FALSE,
  281. + 'import_roles' => array(
  282. + 'flag' => array(),
  283. + 'unflag' => array(),
  284. + ),
  285. +);
  286. +return $flags;
  287. +
  288. +
  289. }
  290. /**
  291. @@ -1294,7 +1325,7 @@ function flag_lists_insert($flag) {
  292. ->fields(array(
  293. 'pfid' => $flag->pfid,
  294. 'uid' => $flag->uid,
  295. - 'content_type' => $flag->content_type,
  296. + 'entity_type' => $flag->entity_type,
  297. 'name' => $flag->name,
  298. 'title' => $flag->title,
  299. 'options' => $flag->get_serialized_options($flag),
  300. @@ -1330,7 +1361,7 @@ function flag_lists_fl_delete($flag, $account = NULL) {
  301. * Used both for the regular callback as well as the JS version. We use this
  302. * instead of the flag module's because our flags are not in the flags table.
  303. */
  304. -function flag_lists_page($action = NULL, $flag_name = NULL, $content_id = NULL) {
  305. +function flag_lists_page($action = NULL, $flag_name = NULL, $entity_id = NULL) {
  306. global $user;
  307. // Shorten up the variables that affect the behavior of this page.
  308. @@ -1341,7 +1372,7 @@ function flag_lists_page($action = NULL, $flag_name = NULL, $content_id = NULL)
  309. $has_js = isset($_GET['has_js']);
  310. // Check the flag token, then perform the flagging.
  311. - if (!flag_check_token($token, $content_id)) {
  312. + if (!flag_check_token($token, $entity_id)) {
  313. $error = t('Bad token. You seem to have followed an invalid link.');
  314. }
  315. elseif ($user->uid == 0 && !$has_js) {
  316. @@ -1355,7 +1386,7 @@ function flag_lists_page($action = NULL, $flag_name = NULL, $content_id = NULL)
  317. // Identify it as ours.
  318. $flag->module = 'flag_lists';
  319. - flag_lists_do_flag($flag, $action, $content_id);
  320. + flag_lists_do_flag($flag, $action, $entity_id);
  321. }
  322. // If an error was received, set a message and exit.
  323. @@ -1381,14 +1412,14 @@ function flag_lists_page($action = NULL, $flag_name = NULL, $content_id = NULL)
  324. // $flag = flag_lists_get_flag($flag_name);
  325. // $flag->link_type = 'toggle';
  326. $sid = flag_get_sid($user->uid);
  327. - $new_action = _flag_lists_is_flagged($flag, $content_id, $user->uid, $sid) ? 'unflag' : 'flag';
  328. - $new_link = $flag->theme($new_action, $content_id, TRUE);
  329. + $new_action = _flag_lists_is_flagged($flag, $entity_id, $user->uid, $sid) ? 'unflag' : 'flag';
  330. + $new_link = $flag->theme($new_action, $entity_id, TRUE);
  331. flag_lists_fix_link($new_link, $new_action);
  332. drupal_json_output(array(
  333. 'status' => TRUE,
  334. 'newLink' => $new_link,
  335. // Further information for the benefit of custom JavaScript event handlers:
  336. - 'contentId' => $content_id,
  337. + 'contentId' => $entity_id,
  338. 'contentType' => $flag->content_type,
  339. 'flagName' => $flag->name,
  340. 'flagStatus' => $action,
  341. @@ -1397,7 +1428,7 @@ function flag_lists_page($action = NULL, $flag_name = NULL, $content_id = NULL)
  342. }
  343. else {
  344. $flag = flag_lists_get_flag($flag->fid);
  345. - drupal_set_message($flag->get_label($action . '_message', $content_id));
  346. + drupal_set_message($flag->get_label($action . '_message', $entity_id));
  347. drupal_goto();
  348. }
  349. }
  350. @@ -1413,7 +1444,7 @@ function flag_lists_fix_link(&$link, $action) {
  351. *
  352. * @param $action
  353. * Either 'flag' or 'unflag'.
  354. - * @param $content_id
  355. + * @param $entity_id
  356. * The ID of the item to flag or unflag.
  357. * @param $account
  358. * The user on whose behalf to flag. Leave empty for the current user.
  359. @@ -1423,7 +1454,7 @@ function flag_lists_fix_link(&$link, $action) {
  360. * FALSE if some error occured (e.g., user has no permission, flag isn't
  361. * applicable to the item, etc.), TRUE otherwise.
  362. */
  363. - function flag_lists_do_flag($flag, $action, $content_id, $account = NULL, $skip_permission_check = FALSE) {
  364. + function flag_lists_do_flag($flag, $action, $entity_id, $account = NULL, $skip_permission_check = FALSE) {
  365. if (!isset($account)) {
  366. $account = $GLOBALS['user'];
  367. }
  368. @@ -1431,7 +1462,7 @@ function flag_lists_fix_link(&$link, $action) {
  369. return FALSE;
  370. }
  371. if (!$skip_permission_check) {
  372. - if (!$flag->access($content_id, $action, $account)) {
  373. + if (!$flag->access($entity_id, $action, $account)) {
  374. // User has no permission to flag/unflag this object.
  375. return FALSE;
  376. }
  377. @@ -1439,7 +1470,7 @@ function flag_lists_fix_link(&$link, $action) {
  378. else {
  379. // We are skipping permission checks. However, at a minimum we must make
  380. // sure the flag applies to this content type:
  381. - if (!$flag->applies_to_content_id($content_id)) {
  382. + if (!$flag->applies_to_content_id($entity_id)) {
  383. return FALSE;
  384. }
  385. }
  386. @@ -1460,17 +1491,17 @@ function flag_lists_fix_link(&$link, $action) {
  387. // Perform the flagging or unflagging of this flag. We invoke hook_flag here
  388. // because we do our own flagging.
  389. - $flagged = _flag_lists_is_flagged($flag, $content_id, $uid, $sid);
  390. + $flagged = _flag_lists_is_flagged($flag, $entity_id, $uid, $sid);
  391. if ($action == 'unflag') {
  392. if ($flagged) {
  393. - $fcid = _flag_lists_unflag($flag, $content_id, $uid, $sid);
  394. - module_invoke_all('flag', 'unflag', $flag, $content_id, $account, $fcid);
  395. + $fcid = _flag_lists_unflag($flag, $entity_id, $uid, $sid);
  396. + module_invoke_all('flag', 'unflag', $flag, $entity_id, $account, $fcid);
  397. }
  398. }
  399. elseif ($action == 'flag') {
  400. if (!$flagged) {
  401. - $fcid = _flag_lists_flag($flag, $content_id, $uid, $sid);
  402. - module_invoke_all('flag', 'flag', $flag, $content_id, $account, $fcid);
  403. + $fcid = _flag_lists_flag($flag, $entity_id, $uid, $sid);
  404. + module_invoke_all('flag', 'flag', $flag, $entity_id, $account, $fcid);
  405. }
  406. }
  407. @@ -1487,12 +1518,12 @@ function flag_lists_fix_link(&$link, $action) {
  408. * bypass it.
  409. *
  410. */
  411. - function _flag_lists_is_flagged($flag, $content_id, $uid, $sid) {
  412. + function _flag_lists_is_flagged($flag, $entity_id, $uid, $sid) {
  413. $query = db_select('flag_lists_content')
  414. ->condition('fid', $flag->fid)
  415. ->condition('uid', $uid)
  416. ->condition('sid', $sid)
  417. - ->condition('content_id', $content_id);
  418. + ->condition('entity_id', $entity_id);
  419. $query->addField('flag_lists_content', 'fid');
  420. return $query->execute()->fetchField();
  421. }
  422. @@ -1504,19 +1535,19 @@ function flag_lists_fix_link(&$link, $action) {
  423. * flag_lists_do_flag() function instead.
  424. *
  425. */
  426. - function _flag_lists_flag($flag, $content_id, $uid, $sid) {
  427. + function _flag_lists_flag($flag, $entity_id, $uid, $sid) {
  428. $fcid = db_insert('flag_lists_content')
  429. ->fields(array(
  430. 'fid' => $flag->fid,
  431. - 'content_type' => $flag->content_type,
  432. - 'content_id' => $content_id,
  433. + 'entity_type' => $flag->entity_type,
  434. + 'entity_id' => $entity_id,
  435. 'uid' => $uid,
  436. 'sid' => $sid,
  437. 'timestamp' => REQUEST_TIME,
  438. ))
  439. ->execute();
  440. - _flag_lists_update_count($flag, $content_id);
  441. + _flag_lists_update_count($flag, $entity_id);
  442. return $fcid;
  443. }
  444. @@ -1527,10 +1558,10 @@ function flag_lists_fix_link(&$link, $action) {
  445. * flag_lists_do_flag() function instead.
  446. *
  447. */
  448. - function _flag_lists_unflag($flag, $content_id, $uid, $sid) {
  449. + function _flag_lists_unflag($flag, $entity_id, $uid, $sid) {
  450. $query = db_select('flag_lists_content')
  451. ->condition('fid', $flag->fid)
  452. - ->condition('content_id', $content_id)
  453. + ->condition('entity_id', $entity_id)
  454. ->condition('uid', $uid)
  455. ->condition('sid', $sid);
  456. $query->addField('flag_lists_content', 'fcid');
  457. @@ -1539,7 +1570,7 @@ function flag_lists_fix_link(&$link, $action) {
  458. db_delete('flag_lists_content')
  459. ->condition('fcid', $fcid)
  460. ->execute();
  461. - _flag_lists_update_count($flag, $content_id);
  462. + _flag_lists_update_count($flag, $entity_id);
  463. }
  464. return $fcid;
  465. }
  466. @@ -1547,11 +1578,11 @@ function flag_lists_fix_link(&$link, $action) {
  467. /**
  468. * Updates the flag count for this content
  469. */
  470. - function _flag_lists_update_count($flag, $content_id) {
  471. + function _flag_lists_update_count($flag, $entity_id) {
  472. $count = db_select('flag_lists_content', 'f')
  473. ->fields('f')
  474. ->condition('fid', $flag->fid)
  475. - ->condition('content_id', $content_id)
  476. + ->condition('entity_id', $entity_id)
  477. ->countQuery()
  478. ->execute()
  479. ->fetchField();
  480. @@ -1559,7 +1590,7 @@ function flag_lists_fix_link(&$link, $action) {
  481. if (empty($count)) {
  482. $num_deleted = db_delete('flag_lists_counts')
  483. ->condition('fid', $flag->fid)
  484. - ->condition('content_id', $content_id)
  485. + ->condition('entity_id', $entity_id)
  486. ->execute();
  487. }
  488. else {
  489. @@ -1568,14 +1599,14 @@ function flag_lists_fix_link(&$link, $action) {
  490. 'count' => $count,
  491. ))
  492. ->condition('fid', $flag->fid)
  493. - ->condition('content_id', $content_id)
  494. + ->condition('entity_id', $entity_id)
  495. ->execute();
  496. if (empty($num_updated)) {
  497. db_insert('flag_lists_counts')
  498. ->fields(array(
  499. 'fid' => $flag->fid,
  500. - 'content_type' => $flag->content_type,
  501. - 'content_id' => $content_id,
  502. + 'entity_type' => $flag->entity_type,
  503. + 'entity_id' => $entity_id,
  504. 'count' => $count,
  505. ))
  506. ->execute();