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.

CommentFileSizeAuthor
#5 rules-1719510.patch669 bytesKen Ficara
#1 rules-1719510.patch765 bytesKen Ficara
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Ken Ficara’s picture

FileSize
765 bytes
Ken Ficara’s picture

Status: Active » Needs review
Ken Ficara’s picture

Version: 7.x-2.1 » 7.x-2.2

Clarifying -- this happens in both 2.2 and 2.1, albeit with a different line number in 2.1.

Status: Needs review » Needs work

The last submitted patch, rules-1719510.patch, failed testing.

Ken Ficara’s picture

Status: Needs work » Needs review
FileSize
669 bytes

Sorry testbot -- ran the diff at drupal root instead of in the rules module. Fixed.

Status: Needs review » Needs work

The last submitted patch, rules-1719510.patch, failed testing.

mitchell’s picture

Version: 7.x-2.2 » 7.x-2.x-dev
Assigned: Unassigned » klausi
Status: Needs work » Reviewed & tested by the community

Works for me.

klausi’s picture

Status: Reviewed & tested by the community » Fixed

Thanks, committed a slightly modified version of this patch.

Status: Fixed » Closed (fixed)

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