I have nodes with entity translations enabled. So I can have a node in 3 translated editions, I would like the workflow to be available for each translation instead of just on an overall node basis. This way each translation can have it's own workflow state - is this possible to achieve in any way?

Comments

nancydru’s picture

Category: support » feature

This is not an unreasonable request. I'll have to look at some way to handle it, if it can be done.

supermoos’s picture

Cool, let me know when something is ready for testing and I'll give a thorough go for you.

johnv’s picture

This would be possible if Workflow were a 'true' Field API field, as proposed in #2019345: Create a 'Workflow Field' with Widget, Formatter, Fieldtype

johnv’s picture

Status: Active » Closed (duplicate)

Let's focus on #2019345.

johnv’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
Issue summary: View changes
Status: Closed (duplicate) » Fixed

This should be working now using Workflow Field. Please re-open if there is a problem.

Status: Fixed » Closed (fixed)

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

danielfdsilva’s picture

Status: Closed (fixed) » Active

Hi there,

I was trying to setup a workflow on a per entity translation basis and ran into all sorts of issues. For this I'm using field translation on the workflow field.
- I noticed that the workflow transition history always stores data with the language set to LANGUAGE_NONE. Why is this so? Doing so won't allow to show the transitions a given translation went through.
- When editing a node, the workflow field shows the value for the LANGUAGE_NONE and not for the actual language being edited. Some digging in the code led me to the workflow.module @line 838. Why is LANGUAGE_NONE hardcoded?
- The workflow field's table in the database contains data for all the languages available on the website instead of only the ones a node is translated to. This doesn't happen with other fields.
- When saving some translations, multiple entries are created in the workflow_node_history table and in some cases the field value for LANGUAGE_NONE is updated (The weirdest thing is that this doesn't happen for every language.)

I don't have the time nor the full knowledge needed to provide a patch assuming that this is an actual issue. However if you need more info let me know.

johnv’s picture

When moving this module from version 1.2 to 2.x, the infrastructure was created to support all 'Field' functionalities.
The problem you describe is not deliberate, but it was not on my testing scope.

I'll try to see if this is a quick-fix, but I cannot promise anything.

danielfdsilva’s picture

Hey all,
I actually needed this to be working for my project so I started digging and changed a few things. The patch I'm providing here is not, nor it is supposed to be, a solution but it could be a start for anyone who wants to fix it.

Use case:
I needed to be able to have a workflow per entity translation and I'm using field translation.

What's working:
- Only the language being edited is saved to the database.
- Workflow node history keeps track of history per language.
- When editing a node the correct value shows up in the field.
- The node/%node/workflow shows the information taking the current language into account.

Not working:
- The workflow views module does not take language into account, more specifically the subquery done by the relationship.

Unknown:
Since these were out of my use case they weren't even tested but could be working.
- Integration with other forms of multi-language
- When there are no translations.
- Scheduled transitions.
- Everything else.

If I can find the time I'll try to get back to it.

johnv’s picture

Thanks for that. Actually, I was working on it this week. I'll compare notes. 1 Thing springs to mind. You use global $language, whereas I use $entity->language.

danielfdsilva’s picture

StatusFileSize
new9.79 KB

Here's the exact same patch as #9 but for the dev version (7.x-2.x-dev).

  • johnv committed 3f565a3 on 7.x-2.x
    Issue #1988990: Added translatability of Workflow Field.
    
johnv’s picture

Above fix adds the translation capabilities.

My main testing focus was to not break existing sites.

- Use of tokens is included.
- The Workflow History tab is still working for untranslated Workflows. For more complex situations like this one, I advice to use the corresponding Workflow 'Entity history' Views display, which is disabled upon installation.
- The list from #9 may still be valid.

Please test and report your findings.

  • johnv committed 6438fbf on 7.x-2.x
    Issue #1988990: Added translatability of Workflow Field - execute...
johnv’s picture

Status: Active » Fixed

This should be fixed. Please reopen if any problems arise within 2 weeks. Else, open a new issue, describing the problem.

Status: Fixed » Closed (fixed)

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