You are here

public function boxes_i18n::render in Boxes translation 6

Same name and namespace in other branches
  1. 7 plugins/boxes/boxes_i18n.inc \boxes_i18n::render()

Implementation of boxes_content::render().

Overrides boxes_simple::render

File

plugins/boxes/boxes_i18n.inc, line 76

Class

boxes_i18n
Simple translatable custom text box.

Code

public function render() {
  global $language;

  // Get the filtered rendered data from boxes_simple.
  $block = parent::render();

  // Handle any multilingual settings.
  if (!empty($this->options['i18n_boxes']['language'])) {
    if ($this->options['i18n_boxes']['language'] == I18N_BOXES_LOCALIZE) {

      // This box is available to translate.
      $block['content'] = i18nstrings_text("boxes:{$this->plugin_key}:{$this->delta}:body", $block['content']);

      // Also translate the title.
      $block['subject'] = i18nstrings("boxes:{$this->plugin_key}:{$this->delta}:title", $block['subject']);
      $block['title'] = $block['subject'];
    }
    elseif ($this->options['i18n_boxes']['language'] != $language->language) {

      // This box does not share the language of the user, so do not display.
      $block = NULL;
    }
  }
  return $block;
}