After using Flag Abuse and configuring the flags embedded in the module, I noticed it is impossible to export them in a feature (see #2284353: Features compatibility ). Is there a reason why flags defined in hook_flag_default_flags() cannot be exported in a feature? What could be done to correct this behaviour?

Currently, we are forced to duplicate these flags. The aforementioned issue goes as far as suggesting to create flags during installation instead of using hook_flag_default_flags(), which somehow makes sense, but defeats the whole purpose of this hook...

Comments

FMB created an issue. See original summary.

joachim’s picture

Status: Active » Fixed

That is a standard problem with all modules that export configuration to Features and also provide their own defaults. The two things are provided by the same system: when you create a feature, you are writing a module with its own hook_flag_default_flags().

There's a module for altering features, which I've not used, but which might do what you want. Alternatively, you could implement the flag alter hook yourself and tweak the flag in code.

FMB’s picture

OK joachim, thanks for your answer.

FMB’s picture

Status: Fixed » Active

It then seems that creating flags during installation like suggested in #2284353: Features compatibility is a better solution, so that hook_flag_default_flags() is reserved for exporting in features. According to my tests, current installations would not be affected by the removal of this hook. Would you confirm this is safe? Thanks in advance.

FMB’s picture

Status: Active » Fixed

Flags defined in this hook are created in the database the first time it is called, therefore it is safe to delete it.

Status: Fixed » Closed (fixed)

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