Flag State

Categories

Component ID

1125914

Component name

Flag State

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Downloads

551

Component created

Component changed

Component body

Flag State is a small module that implements a very basic Flag type which can be used to control and maintain a boolean state flag for use in code or Rules evaluations. It gets all the benefits and features of the flag module including per user/global state, anonymous user support (Flag 2.x), flexible UI, export (features) friendly, integration with rules and views modules etc.

State flags are useful as a quick way of adding per user or global on/off switches.

The flag can be displayed on a block or elsewhere. Either do this in your theme, custom module or use the php filter in a custom block etc, Views header text etc. The code to render the flag is:

  return flag_create_link('<flag_name>', 1);

For example use see my browsing history feature demo where the "Turn OFF browsing history" link (rendered in the View header) sets or unsets a state flag that is used in rules as a) a condition to disable the user's browsing history and b) as an event to clear the user's browsing history.