Comments

hass’s picture

Status: Active » Needs review
StatusFileSize
new18.84 KB

Patch attached:

  • Changed table names to singular (D7 rule)
  • Made states translatable
  • Simplified SQL code
  • Used Drupal API for classes and IDs
  • Added upgrade path from 1.x (untested, need some help)
  • Fixed code style issues
  • Corrected translatable strings and added missing Operations title
hass’s picture

Issue summary: View changes
Priority: Normal » Major
Tobias Xy’s picture

I think this will be a great patch. It looks good, but the upgrade path has to be thoroughly tested, because it isn't really trivial.

-In version 1.x only the bundle is stored in the database, not the entity. So I guess it's possible to create conditional states for entities that aren't nodes, but if two different entity types have a bundle with the same name, there will be a lot of confusion (errors, unexpected behaviors, etc.). So it isn't easy to determine the entity type a bundle in 1.x is referring to. But probably most of the people used FCS only for nodes, so assuming 'node' as entity for 2.x should be ok here.

-The trigger_state should be "checked" (or "unchecked") for boolean control fields and "value" for control fields that are select lists.

That was just a quick review of your patch. I'll test the upgrade path this evening.

Tobias Xy’s picture

StatusFileSize
new20.14 KB

No major changes, just made sure, it can be applied to the latest dev-version.

Tobias Xy’s picture

StatusFileSize
new20.43 KB

I just tested the upgrade path and solved a lot of problems:
-two syntax errors
-The field trigger_state has to be added during field_conditional_state_update_7200
-When adding the new fields to field_conditional_state an initial value must be given. Otherwise the update will fail.
-We have to create a FCS group for each condition of version 1.x
-A few other things

TODO:
-For checkboxes as control fields "checked" must be used (not 'value').
-Currently it's not possible to use drupal_html_id in field_conditional_state_element_process without breaking the states functionality on the form. (See #2110913: drupal_html_id for id's)

Tobias Xy’s picture

Status: Needs review » Needs work
Tobias Xy’s picture

Project: Field Conditional State (unsupported) » Field Conditional States
Tobias Xy’s picture

Status: Needs work » Needs review
StatusFileSize
new22.67 KB

The appended patch should be good to go.
Because the upgrade from 1.x to 2.x isn't that easy, it should be thoroughly tested now, before we finally release a stable version.

hass’s picture

How about committing if you know it works well? I do not expect any tester.

Tobias Xy’s picture

It's a very complex migration, so I can't guarantee, that it is out of bugs. I will make a few tests and after that going to commit it, because you're probably right: No testers expected... :D

hass’s picture

What is the reason for setting the module weight? This should be documented in the install hook.

Tobias Xy’s picture

It was set in 1.x too, so I think it is there for a reason. peem83 should know it, but I don't... (Unfortunately it was there since the first commit of FCS, so there is no issue describing the reasons for that).

hass’s picture

Nothing to worry, we may change it if we find out.

Tobias Xy’s picture

Status: Needs review » Fixed

I finally committed the patch. Any follow up issues should probably be handled separately.

Status: Fixed » Closed (fixed)

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