To recreate:

  1. create a custom link type with hook_flag_link_types
  2. assign this type to a flag
  3. disable the module that defines the link type
  4. view a node associated with the flag

Attached patch:

  • inserts warning into watchdog
  • if user_access("administer flags') then drupal_set_message warning
  • return from function without creating link for the flag

Comments

quicksketch’s picture

This looks like a bug caused by another module the failed to revert the link type when it was disables/uninstalled. It seems like the providing module should be responsible for changing the link type back to a link provided by Flag, rather than just stranding the site without a valid link type on its flags.

However I agree it'd be good not to leave the site completely stranded, instead provide something like Views' broken handler functionality.

quicksketch’s picture

StatusFileSize
new3.29 KB

Completely going back on what I said earlier, I've decided to use the attached patch which actually falls back to the "normal" link if a link type cannot be found. An error is not logged to watchdog, because this could happen many times per page load and completely flood watchdog with redundant errors. An error is presented to the administrator when configuring a flag that has lost its previous flag type.

quicksketch’s picture

Status: Needs review » Fixed

I committed #2, please reopen if there is a bug in the approach, otherwise open a new issue for any functionality changes.

Status: Fixed » Closed (fixed)

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