Just discovered the 7.3.x series of Flag that is the current version of Flag that is actively developing at the moment. The module itself bring me the correct apply implementation to the two default flags that comes with Statuses and here there are.
$flags['like'] = array(
'entity_type' => 'statuses',
'title' => 'Like',
'global' => '0',
'types' =>
array(
0 => 'page',
),
'flag_short' => 'Like',
'flag_long' => '',
'flag_message' => '',
'unflag_short' => 'Un-like',
'unflag_long' => '',
'unflag_message' => '',
'unflag_denied_text' => '',
'link_type' => 'toggle',
'weight' => 0,
'show_on_page' => false,
'show_on_teaser' => false,
'show_on_form' => false,
'status' => false,
'locked' =>
array(
'name' => 'name',
'global' => 'global',
'types' => 'types',
'show_on_teaser' => 'show_on_teaser',
'show_on_form' => 'show_on_form',
'status' => 'status',
),
'module' => 'fbss_flag',
'api_version' => 3,
'import_roles' =>
array(
'flag' =>
array(
0 => '2',
),
'unflag' =>
array(
0 => '2',
),
),
);
$flags['follow'] = array(
'entity_type' => 'user',
'title' => 'Follow',
'global' => '0',
'types' =>
array(
0 => '-',
),
'flag_short' => 'Follow',
'flag_long' => '',
'flag_message' => 'Following',
'unflag_short' => 'Unfollow',
'unflag_long' => '',
'unflag_message' => '',
'unflag_denied_text' => '',
'link_type' => 'toggle',
'weight' => 0,
'show_on_profile' => 'true',
'access_uid' => '',
'show_on_page' => true,
'show_on_teaser' => false,
'show_on_form' => false,
'status' => false,
'locked' =>
array(
'name' => 'name',
'global' => 'global',
'types' => 'types',
'show_on_teaser' => 'show_on_teaser',
'show_on_form' => 'show_on_form',
'status' => 'status',
),
'module' => 'fbss_flag',
'api_version' => 3,
'import_roles' =>
array(
'flag' =>
array(
0 => '2',
),
'unflag' =>
array(
0 => '2',
),
),
);
I don't know if is a good aproach to detect the Flag API installed and then conditionally select the correct definition of flags. Anyway if someone needs just pasting the code on fbss_flag.module works for me.
Comments
Comment #1
eidoscomOoops!!!
Sorry, the "Follow" flag is working but not the Statuses one as seems to require to Status be an entity :S
Comment #2
eidoscomI installed Flag 7.x.2-0 and the default flags doesn't work because of API changes I think...
Comment #3
eidoscomNew Flag implementations are focused on entities so I think is a must to Statuses become entities and has no sense to patch te fbss_flag module in order to work with the new versions of Flag. What you think?
Comment #4
eidoscomComment #5
eidoscomIn don't know how but flags are working with statuses and Flag 2.0 sorry for this weird issue :S
Comment #6
mathankumarc commentedThanks for letting us know. I think flag changed a lot in 3.x
Holding on this until Statuses 2.x would be better.
Assigning to Isaac for getting inputs from him.
Comment #7
icecreamyou commentedMy policy has always been that I will support the non-recommended versions of integrated modules as long as the recommended version is also supported. No reason to push this off to Statuses 2.x necessarily -- happy to accept patches -- but this shouldn't be a priority for Statuses maintainers relative to issues that actually block release of Statuses 7.x-1.0. (We can always get it in 1.1 or later though.) Additionally, I usually defer supporting new versions of modules until the API documentation catches up, although in this case we should be okay since the changes from Flag 2.x are documented in change requests.
Obviously this is assuming that no major API changes would be necessary for Flag 3.x support. (Making Statuses entities is probably not an API change because all it does is make some core functions work on statuses, but making Statuses fieldable would definitely need to wait for Statuses 2.x if we decide to do that. If we do make Statuses entities we should address that separately.)
@eidoscom: in the future, if you need to paste a lot of text into an issue (e.g. an export) please attach it in a text file to make it easier to scroll down the issue and read responses. Thanks.
Comment #8
icecreamyou commented[title]
Comment #9
eidoscomOk I will take in account ;)
Comment #10
lifeinpoetry commentedI've created a patch but it doesn't work with Rules because what is flagged in Flags 7.3.x needs to be an entity to be added to Rules by Flags and even when I worked around that there were issues with statuses not being an entity in Rules since Rules relies on the Entity API. I couldn't get tokens working at all and I tracked down where flagged_statuses was being changed into something unusable (an array instead of the status sid) and couldn't figure out a way beyond it.
I managed to get it to work on my configuration by making statuses an entity through a separate custom module but that seems to be beyond the scope of the current Statuses 7.1.x.
Also, hook_link seems to have been removed in Drupal 7 so flags weren't showing up for me without using fbss_flag_statuses_link() but I'm not certain if this is an issue with people using an earlier version of Flags so I didn't touch it. Could open an issue and put in a separate patch, if necessary.
Comment #11
icecreamyou commented@lifeinpoetry: Thanks for the patch. There is some initial work on statuses-as-entities here.
Unfortunately I have been really busy lately and have not had time to work on Statuses in a few weeks. It may be awhile until I can review this patch, although maybe mathankumarc will be able to take a look. In the mean time, testers welcome. :)
The best way to handle this is to find a function that is in one branch of the module and not the other, and use that to test which version is being run.
Comment #12
icecreamyou commentedComment #13
mathankumarc commentedThanks for the awesome work :)
I think its better to postpone this until we have 2.x branch in place with statuses as an entity.
I'm yet to look into the changes made in Flag 3.x
I'm eager to work on converting statuses as entity, however as Isaac mentioned in earlier issues having a stable branch would be the high priority as of now.
@lifeinpoetry could you please upload those files in a new issue, that will help us in the progress.
Comment #14
adamtong commentedHi, maybe i should not ask this question as i know you are very busy in daily life. However, could you kindly just give me a rough roadmap for the 2.x branch?
As i am really looking forward to the great 2.x branch. But at the moment, I would like to decide whether I use the 1.x branch in development first OR just wait for the 2.x branch if no need to wait too long.
As I think there may not be upgrade path for 1.x to 2.x, right?
Thank you very much!!!
Comment #15
adamtong commentedI have tested the above patch #10. It doesn't work for "fbss_comment". It shows the following error when edit:
The module providing this flag wasn't found, or this flag type, fbss_comment, isn't valid.
Also, there will be no "role" assigned to the flag for both statuses and fbss_comment flags.
Also, the "follow" flag also has problem. The Views of "statuses_followed" will not show followed users' status.
For status flag, I cannot choose any "Flaggable types" so I cannot save the flag successfully.
I have tried to apply the patch of "https://drupal.org/node/1311468#comment-5619252" to make the status to entity. However, it still not working.
Thank you.
Comment #16
icecreamyou commentedI don't think this needs to wait for the 2.x branch. I don't know if there will be a 2.x branch given the rate of development lately.
Comment #17
mathankumarc commentedI'm really feel bad to hear this, however I accept the fact that the development rate is very low as of now. Lets try to find out the solution.
When we had a Drupal meetup in our City, I got to know that lot of peoples are using our module(both FBSS and Statuses) and they waiting for the Statuses 2.x branch(Sad thing is none of them contributing to the module), So the development will help lot of people.
Let me know your thoughts on this.
Comment #18
adamtong commentedI also really looking forward to the 2.x Branch too.
Comment #19
icecreamyou commentedPosted my thoughts in #1311468: Thoughts on 7.x-2.x
Comment #20
fruitsalad commentedHi all,
just wanted to ask if there is a solution for this problem? I took the code from the updated flags and put it into the module files but the above error still occurs.
thank you all for your help.
Comment #21
jweirather commentedFollowing up just to clarify:
Is that about right?
Comment #22
apoc1 commentedSo, I followed the instructions in the module and pasted the update code, found on admin/structure/flags/manage/like/update into fbss_flag.module inside the fbss_flag_flag_default_flags() function. When I did so, on the flag overview page, the flag became enableable, but when I click on enable I get this message:
"The module providing this flag wasn't found, or this flag type, statuses, isn't valid."
I use flag 7.x-3.6 and statuses flag 7.x-1.0-beta2.
What am I doing wrong?
Comment #23
Gaurav.Singh commentedI have the same issue, "The module providing this flag wasn't found, or this flag type, statuses, isn't valid." also after applying patch
https://www.drupal.org/files/statuses-add-flag-3-support-1787930.patch
if I enable like, everything starts to work..but with an issue.. every status starts repeating multiple times as soon I flag it.
Help me out on this.
Regards
Comment #24
madhavimalgaonkar commentedI have the same issue, "The module providing this flag wasn't found, or this flag type, statuses, isn't valid." After applying patch
https://www.drupal.org/files/statuses-add-flag-3-support-1787930.patch it works absolutely fine.
Thank You