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

crea’s picture

This 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) ;)))))

crea’s picture

Hmmm, 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.

quicksketch’s picture

Status: Active » Postponed

This sounds like a reasonable request but I have no intention of implementing it.

joachim’s picture

Version: 6.x-2.x-dev » 7.x-3.x-dev

> 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.

joachim’s picture

Issue tags: +Novice

Tagging 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.

alexweber’s picture

Sure, what's required?