Greetings,
When I go the flag page I get this message:
Some flags provided by modules need to be updated to a new format before they can be used with this version of Flag. See the disabled flags for a list of flags that need updating.
When I click update code it forwards me to a page contains a code and instructions to paste the code into a function in the trash_flag module:
The flag trash is currently using the Flag API version 2, which is not compatible with the current version of Flag. You can upgrade this flag by pasting the below code into trash_flag_flag_default_flags() function in the trash_flag.module file.
and this is the code:
$flags = array();
// Exported flag: "Trash".
$flags['trash'] = array(
'entity_type' => 'node',
'title' => 'Trash',
'global' => 1,
'types' => array(),
'flag_short' => 'Move to Trash',
'flag_long' => 'Move item to the site trash bin.',
'flag_message' => 'Item has been trashed',
'unflag_short' => 'Remove from Trash',
'unflag_long' => 'Remove from trash item and restore previous access settings.',
'unflag_message' => 'Item removed from Trash',
'unflag_denied_text' => 'trashed',
'link_type' => 'confirm',
'weight' => 0,
'show_on_form' => 0,
'access_author' => '',
'show_on_teaser' => 0,
'show_contextual_link' => FALSE,
'i18n' => 0,
'flag_confirmation' => 'Are you sure you want to trash this item? You may be unable to access it after trashing.',
'unflag_confirmation' => 'Are you sure you want to remove this item from trash?',
'module' => 'trash_flag',
'locked' => array(
'name' => 'name',
),
'api_version' => 3,
'status' => FALSE,
'import_roles' => array(
'flag' => array(),
'unflag' => array(),
),
'show_in_links' => array(
'full' => TRUE,
),
);
return $flags;
I searched for the function but couldn't find it.
Thanks!
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | trash_flag-update_to_flag_3-2133655-9.patch | 946 bytes | mpotter |
| #8 | trash_flag-update_to_flag_3-2133655-8.patch | 699 bytes | mpotter |
| #6 | trash_flag-2133655-6-Not-compatible-with-flag-3.patch | 4.37 KB | geek-merlin |
Comments
Comment #1
Yuri commentedAny updates on this issue?
Comment #2
mpotter commentedThis function is located in the trash_flag.features.inc file.
However, I need to think about the best way to do this. We need to be able to support people using both versions of the Flag module. How is Flag handling the backwards compatibility? For example, does it automatically upgrade existing flags on a site when you install it?
Since the API version is given right there in the array it seems like Flags should be recognizing this and supporting it. My guess is that we'll need to put some sort of version check so that we generate a different array based on what version of Flag is being used.
So, this issue still needs more work.
Comment #3
hefox commentedWe could also just roll a 7.x-3.x version that supports flag 3.x
Comment #4
geek-merlin> We could also just roll a 7.x-3.x version that supports flag 3.x
+10
Comment #5
geek-merlin> How is Flag handling the backwards compatibility? For example, does it automatically upgrade existing flags on a site when you install it?
Yes it has a reliable upgrade path.
> My guess is that we'll need to put some sort of version check so that we generate a different array based on what version of Flag is being used.
Yes that's a cool idea so we won't have different versions to maintain.
Comment #6
geek-merlinPatch flying in that implements this.
I checked that on my site an upgrade to flag 3 runs cleanly and that trash_flag_flag_default_flags() returns the right array.
Comment #7
geek-merlinI also checked api changes. None relevant.
There is a minor change in hook_flag_access() and hook_flag_access_multiple():
In flag 3 a return denies access while in 2 it just did not grant.
This will just be an issue when there are multiple access control modules.
My patch over at #2718401: Views permissions broken is already prepared for the 3 semantics.
Comment #8
mpotter commentedThe 1.0 stable release of this module added support for Flag 3.x. I choose not to maintain backward compatibility with Flag 2.x since it is quite old now (people can just use the previous version of trash_flag if they need Flag 2.x).
However, there was an additional API change in Flag where hook_flag was replaced with hook_flag_flag and hook_flag_unflag. This patch adds that change.
Comment #9
mpotter commentedActually, here is a better patch with a better helper function name and removing the reference to the old hook_flag.
Comment #11
mpotter commentedCommitted to a69a3bf.
Comment #12
geek-merlinCool you got this in!
I just noted that the changes from #6 on trash_flag_flag_default_flags() did not land in the commit. Does this make sense?
(Even if we drop the 2.x support, the features export changed.)
(Just re-close if that's ok)
Comment #13
mpotter commentedThe change to trash_flag_flag_default_flags() was already done in commit 207f2d29. I didn't see this issue and was going through all of Atrium and dependencies doing the Flag 3.x update.