If I create a new rule, set the action to "show a message on the site," and then click the "Switch to data selector" button, I get an error:
Notice: Undefined index: custom translation language in selectionForm() (line 90 of /.../sites/all/modules/rules/ui/ui.data.inc
The error happens right here:
if (!empty($info['translatable'])) {
if ($info['custom translation language']) {
It checks whether $info['translatable'] is empty, but then acts on the value of $info['custom translation language'] without knowing whether or not it exists.
This has been reported elsewhere (See #1533398: Token replacements don't work on parameters with type "entity") but the fix on that was related to something else, probably whatever upstream caller is setting the former value without setting the latter. I assume this is a mistake in how this function is called, probably by another module, but why not do a second check before using that value? This simple change removed the error and lets me create the rule, without having to figure out why the function is being called with apparently mis-set parameters:
if (!empty($info['translatable'])) {
if (!empty($info['custom translation language'])) {
This looks like it will work fine; the following "else" is accurate in that the field will not be translated to the configured language if there is none set.
Comment | File | Size | Author |
---|---|---|---|
#5 | rules-1719510.patch | 669 bytes | Ken Ficara |
#1 | rules-1719510.patch | 765 bytes | Ken Ficara |
Comments
Comment #1
Ken Ficara CreditAttribution: Ken Ficara commentedComment #2
Ken Ficara CreditAttribution: Ken Ficara commentedComment #3
Ken Ficara CreditAttribution: Ken Ficara commentedClarifying -- this happens in both 2.2 and 2.1, albeit with a different line number in 2.1.
Comment #5
Ken Ficara CreditAttribution: Ken Ficara commentedSorry testbot -- ran the diff at drupal root instead of in the rules module. Fixed.
Comment #8
mitchell CreditAttribution: mitchell commentedWorks for me.
Comment #9
klausiThanks, committed a slightly modified version of this patch.