Here's how to reproduce this problem:

1) Install module.
2) Go to /admin/structure/flags/lists/list.

And that's it. Am I the only one getting the following error message?

"Notice: Trying to get property of non-object in flag_lists_handler_filter_template->get_value_options() (line 12 of C:\Wamp\www\sites\all\modules\flag_lists\includes\flag_lists_handler_filter_template.inc)."

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

wwwjaylee created an issue. See original summary.

sl27257’s picture

Assigned: Unassigned » sl27257

Hi,

I have not seen this. But it is a long time since I did a fresh install. Actually it is even longer since I built a site STARTING with flag_lists 7.x-3.x. All cases has been based on a upgrade from a 7.x-1.x flag_lists. So this might very well be a real bug you have spotted. I checked the code and it is obvious what is causing it. I.e. there is no flag_lists template. But the should be one by default...

Did this go away after a while? Are there more error messages in the log?

BR

/Thomas

ankur.addweb’s picture

I get the same error on admin/structure/flags/lists/list.

"Notice: Trying to get property of non-object in flag_lists_handler_filter_template->get_value_options() (line 12 of /sites/all/modules/flag_lists/includes/flag_lists_handler_filter_template.inc).

No default template is added. I added new template and cleared cache as well but the error stays. No additional info in logs as well.

sl27257’s picture

There seems to be two problem here.

  1. The first is that if there is no template you get the error message. The absence of a template should not generate an error message like this.
  2. The template shall be correctly created at a fresh install. (I.e. when not upgrading from an earlier release)

Anyhow patches are on their way... :)

/Thomas

sl27257’s picture

Status: Active » Needs review
FileSize
1.43 KB

Here is the promised patch. Please try it out!

It handles both 1) and 2). You can discuss if one message is info and one is warning or if both are info (That is yellow or green background) Anyhow both the cases with a fresh install and when you have deleted all flag lists templates shall be handled correctly.

(The patch is relative to the -dev version)

jay.lee.bio’s picture

#5 works. But I don't think it's entirely 100% correct.

1) Before:

I get the same exact behavior as @darshi at #3.

2) After:

The error message is definitely gone. But if I go to /admin/structure/flags/lists/list, here's what happens:

A) It'll initially say "No enabled template found, enable the built in flag lists template". So I enable it.
B) Now if I go back to /admin/structure/flags/lists/list, it'll say "No templates found, create a flag lists template". So I create one.
C) Now if I go back to /admin/structure/flags/lists/list, it'll STILL say "No templates found, create a flag lists template".

So I looked at the code, found which table to look for in the database and noticed that the flag_lists_types table is always empty (which is definitely not the case if I use an older version of the module). Any idea why?

sl27257’s picture

Regarding A) Did you use the provided link to enable the default list? It is not OK to just use the enable link provided by the flag module at /admin/structure/flags. You must set it up correctly as well.

B) and C) should work. There is no change since before. There are two steps involved. First naming it and then setup it up. You at least need to select a Bundle to connect it to.

Your last finding that the flag_lists_types shall be populated is correct. However in order for you to get the "Enable message" in A) this table must be filled. (According to my findings i.e...)

Did you install from scratch or did you re-install the flag_lists module? The safe (and probably correct) way to do it is to first remove all flag_lists items, then remove the flag_lists templates and finally go to the "/admin/modules/uninstall" and uninstall it there.

/Thomas

BTW: I am NOT using the #1777412: is that possible to build list as entity, so that the lists can have more properties patch here

jay.lee.bio’s picture

Ok I think I know what's causing this issue:

1) After initial installation, there IS an entry in the flag_lists_types table.
2) However, the source of the problem is if and when I save any new or existing template without selecting a bundle, because it looks like this DELETES the respective entry in the flag_lists_types table.
3) And the real problem is that once a template is saved without selecting a bundle, the flag_lists_types table will ALWAYS be left empty for that template, even if I select a bundle again.

I think an obvious solution would be to make selecting at least one bundle a requirement. What do you think?

P.S. I'm not using the patch here either.

  • sl27257 committed 30a0eca on 7.x-3.x
    Issue #2803225 by sl27257, wwwjaylee: "Trying to get property of non-...
sl27257’s picture

Status: Needs review » Active

I pushed the patch above to the 7.x-3.x dev-branch. I am however not sure that it completely fixes all problems seen with a fresh install and the first template so I leave it as "active" for a while.

(Now I'll go back to the 1777412 branch... :) )

sl27257’s picture

Status: Active » Fixed
sl27257’s picture

Status: Fixed » Closed (fixed)