I'm working on integration of custom content panes (exportable) with i18n module. I've implemented building of translation strings and there is possibility to translate custom content pane's title and body using Translate Interface.

But I can't find the way how to inject this translation into rendering of this content type in ctools_custom_content_type_render(). I've tried to replace title and body in pane settings using hook_panels_pane_prerender() but it didn't work because of full reload of content in ctools_custom_content_type_render().

Is there any way I can do this without patching the ctools module. Or I should implement this feature as patch for ctools module and introduce 18n_string support in the ctools_custom_content_type_render() function? Like similar task was implemented for nodes in ctools_node_content_type_render():

// Support node translation
  if (module_exists('translation')) {
    if ($translations = module_invoke('translation', 'node_get_translations', $nid)) {
      if (isset($translations[$GLOBALS['language']->language]))  {
        $nid = $translations[$GLOBALS['language']->language]->nid;
      }
    }
  }

Thanks,
Artem

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

berdyshev’s picture

Status: Active » Needs review
FileSize
754 bytes

I've patched ctools module for now with attached patch and implemented contrib module for content translation

berdyshev’s picture

Issue summary: View changes

Updated issue summary.

Chris Matthews’s picture

Issue summary: View changes
Status: Needs review » Needs work
Issue tags: +Needs reroll

The 6 year old patch to custom.inc does not apply to the latest ctools 7.x-1.x-dev so it will need a reroll.

Checking patch plugins/content_types/custom/custom.inc...
warning: plugins/content_types/custom/custom.inc has type 100644, expected 100755
error: while searching for:
function ctools_custom_content_type_render($subtype, $conf, $args, $contexts) {
  $settings = ctools_custom_content_type_get_conf(ctools_custom_content_type_content_type($subtype), $conf);

  static $delta = 0;

  $block          = new stdClass();

error: patch failed: plugins/content_types/custom/custom.inc:170
error: plugins/content_types/custom/custom.inc: patch does not apply
Andrew Answer’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
760 bytes

Patch rerolled.

MustangGB’s picture

Category: Support request » Feature request