If I implement link type with it's own options that applies only to flags of some content type, I can check flag content type in hook_flag_options_alter() and decide if I should pass options in. However my link type without options still displays in radiobuttons which makes me to hide it using form_alter. Would be better if hook_flag_link_types() was provided with $flag object to let modules decide if they implement link for this kind of flag or not. Another option is to let hook_flag_link_types() include supported content types in link type definitions it returns.
Comments
Comment #1
crea CreditAttribution: crea commentedThis will also fix situation with passing options that don't apply. Currently I need to pass options in hook_flag_link_types() for them to be beatifully rendered as dependant, then because inside that hook I don't have flag object, I check flag content types inside hook_flag_options_alter() and unset them. This is not convenient and is little ugly, isn't it ? Though it fits nicely into general Drupal developer experience (do then undo) ;)))))
Comment #2
crea CreditAttribution: crea commentedHmmm, it seems I misunderstood the way link options work. Actually, I don't need to unset options that don't apply, because Flag pulls options only for the currently used link type. However original feature requests stands: we still need convenient way to hide link types that don't apply.
Comment #3
quicksketchThis sounds like a reasonable request but I have no intention of implementing it.
Comment #4
joachim CreditAttribution: joachim commented> Another option is to let hook_flag_link_types() include supported content types in link type definitions it returns.
That's the option that seems best to me. Though I would say flag types rather than entity types, and allow the property to be absent to mean it works with all flags.
Upping the version.
Is the OP still interested in this feature? If not, I'll leave this postponed.
Comment #5
joachim CreditAttribution: joachim commentedTagging as novice -- should be fairly simple to implement, with a bit of guidance. If anyone should be interested in tackling this, please post and I'll outline what's required.
Comment #6
alexweber CreditAttribution: alexweber commentedSure, what's required?