I'll have a patch for this in a few minutes.

More details: Line 1212 of includes/translation.handler.inc.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

colan’s picture

Issue summary: View changes
colan’s picture

Status: Active » Needs review
FileSize
1.03 KB

Patch attached.

stefanos.petrakis@gmail.com’s picture

Status: Needs review » Reviewed & tested by the community

Simple fix.

plach’s picture

+++ b/includes/translation.handler.inc
@@ -1209,7 +1209,7 @@ class EntityTranslationDefaultHandler implements EntityTranslationHandlerInterfa
+      $translate = !$new_translation && isset($translations->data[$form_langcode]['translate']) && $translations->data[$form_langcode]['translate'];

If I'm not mistaken, this should be equivalent to:

$translate = !$new_translation && !empty($translations->data[$form_langcode]['translate']);

This form would be more readable...

stefanos.petrakis@gmail.com’s picture

Reads better, agreed.
The value of $translations->data[$form_langcode]['translate'] (0 or 1) should still be part of the logical conjuction, right?

$translate = !$new_translation && !empty($translations->data[$form_langcode]['translate']) && $translations->data[$form_langcode]['translate'];
plach’s picture

Status: Reviewed & tested by the community » Needs review

The value of $translations->data[$form_langcode]['translate'] (0 or 1) should still be part of the logical conjuction, right?

!empty($translations->data[$form_langcode]['translate']) will return TRUE if the value is defined AND evaluates to TRUE, while it will return FALSE if it's not defined OR it evaluates to FALSE. So I think what I suggested above should be enough, although I did not test it.

stefanos.petrakis@gmail.com’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
643 bytes

Also agreed for the definition of empty().
Re-rolling with more compact code (=> easier reading).
Setting this to 'tested' again; that was the status before this syntactical enhancement, which was checked for correctness.

  • plach committed 85c1bc7 on 7.x-1.x authored by colan
    Issue #2215771 by colan, stefanos.petrakis: Fixed "Undefined index:...
plach’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed, thanks!

Status: Fixed » Closed (fixed)

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