Comments

joachim’s picture

Issue tags: +Novice

Tagging.

bartmcpherson’s picture

Status: Active » Needs review
StatusFileSize
new570 bytes

My first attempt at creating a patch.

joachim’s picture

Status: Needs review » Needs work

That's a pretty good attempt! Unfortunately, you've got the flag and the views api mixed up:

+++ b/flag.module
@@ -14,7 +14,7 @@
-define('FLAG_API_VERSION', 2);
+define('FLAG_API_VERSION', 3);

That bit's the flag API. That doesn't need to change (not right now at least).

+++ b/flag.module
@@ -194,7 +194,7 @@ function flag_init() {
-    'api' => 2.0,
+    'api' => FLAG_API_VERSION,

Hence you should use a hardcoded number here. Probably 3.0 rather than 3, but check what Views itself declares.

bartmcpherson’s picture

Status: Needs work » Needs review
StatusFileSize
new308 bytes

Ah! Thanks for the follow up. I think I get it now.

I verified that views.api.php uses 3 and not 3.0

function hook_views_api() {
  return array(
    'api' => 3,
    'path' => drupal_get_path('module', 'example') . '/includes/views',
    'template path' => drupal_get_path('module', 'example') . '/themes',
  );
}
joachim’s picture

Version: 7.x-2.x-dev » 7.x-3.x-dev
Status: Needs review » Needs work

That'll be Views documentation that's inaccurate, sorry....

It's actually 3.0 in the code. It's possible it doesn't matter, but I'd rather we err on the side of caution :)

function views_api_version() {
  return '3.0';
}

Bumping version (ours, that is!) to 3.x too.

bartmcpherson’s picture

Status: Needs work » Needs review
StatusFileSize
new516 bytes

Thank you so much for taking the time and having patience with me while completing this. I know it should have been an open and shut change.

Updated Flags API version to 3.
Updated Views API version to 3.0.

joachim’s picture

Status: Needs review » Needs work

> Updated Flags API version to 3.

No, not that bit! Just the views api bit :)

And you're welcome. We're all beginners once and we all have to start somewhere.

bartmcpherson’s picture

Status: Needs work » Needs review
StatusFileSize
new316 bytes

Hopefully the final version of the patch for this issue.
Updated module to specify views api version 3.0.

joachim’s picture

Status: Needs review » Fixed

Perfect!

Thanks for working on this :)

Committed and pushed:

Issue #1698146 by bartmcpherson: Fixed hook_views_api() version.

joachim’s picture

Version: 7.x-3.x-dev » 7.x-2.x-dev

Cherry-picked to 7.x-2.x too.

Automatically closed -- issue fixed for 2 weeks with no activity.