If a display extender declares an option with the unpack_translatable callback, the callback does not get called. This is because views_object::unpack_translatable does not find the callback method on the display object (since this method is implemented on the display extender).

The solution is to override unpack_translatable on the views_plugin_display to loop over extenders. Patch to follow.

Comments

dawehner’s picture

Interesting!

infojunkie’s picture

Patch attached.

infojunkie’s picture

Status: Active » Needs review
dawehner’s picture

Given that we have to port this patch to Drupal 8 we need some kind of test and some point. Do you have the time to write one? Not sure though whether there exists one for display handlers in D7 already tbh.

infojunkie’s picture

We need this patch for the module Views Label Tooltip to work correctly in translation, and for any future field "extender" as described here: http://thereisamoduleforthat.com/content/recipe-extending-views-handlers...

I can write a test for D7 if that helps.

infojunkie’s picture

Added test to patch. Test fails when views_plugin_display is not patched.

infojunkie’s picture

Status: Needs review » Needs work
infojunkie’s picture

Status: Needs work » Needs review
berliner’s picture

Is there any reason why the test doesn't run?

berliner’s picture

berliner’s picture

stefan.r’s picture

reuploading the previous patch

chris matthews’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

The 3 year old patch in #12 does not apply to the latest views 7.x-3.x-dev and if still relevant needs to be rerolled.

Checking patch plugins/views_plugin_display.inc...
error: while searching for:
    return $output;
  }

  function unpack_style($indent, $prefix, $storage, $option, $definition, $parents) {
    $output = '';
    $style_plugin = $this->get_plugin();

error: patch failed: plugins/views_plugin_display.inc:2960
error: plugins/views_plugin_display.inc: patch does not apply

Checking patch tests/test_plugins/views_test_plugin_display_extender.inc...
error: tests/test_plugins/views_test_plugin_display_extender.inc: No such file or directory

Checking patch tests/views_translatable_display_extender.test...
error: tests/views_translatable_display_extender.test: No such file or directory

Checking patch views.info...
Hunk #1 succeeded at 291 (offset 9 lines).
Hunk #2 succeeded at 314 (offset 10 lines).
andrew answer’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new14.52 KB

Patch rerolled.

andrew answer’s picture

By unidentified reason CI system don't create test files from patch. Anybody can help?

mustanggb’s picture

Malformed patch, new files should look something like:

...
diff --git a/tests/test_plugins/views_test_plugin_display_extender.inc b/tests/test_plugins/views_test_plugin_display_extender.inc
new file mode 100644
index 0000000..4ae8708
--- /dev/null
+++ b/tests/test_plugins/views_test_plugin_display_extender.inc
...
damienmckenna’s picture

StatusFileSize
new14.5 KB

Rerolled again.