You are here

function tmgmt_node_handler_field_translation_language_status::init in Translation Management Tool 7

Init the handler with necessary data.

Parameters

view $view: The $view object this handler is attached to.

array $options: The item from the database; the actual contents of this will vary based upon the type of handler.

Overrides views_handler_field::init

File

sources/node/views/handlers/tmgmt_node_handler_field_translation_language_status.inc, line 27

Class

tmgmt_node_handler_field_translation_language_status
Field handler to display the status of all languages.

Code

function init(&$view, &$options) {
  parent::init($view, $options);
  $this->view
    ->init_style();
  $this->additional_fields['nid'] = 'nid';

  /**
   * Dynamically add new fields so they are used
   */
  $languages = language_list('language');
  foreach ($languages as $langcode => $lang_info) {
    $handler = views_get_handler($this->table, $this->field . '_single', 'field');
    if ($handler) {
      $id = $options['id'] . '_single_' . $langcode;
      $this->view->display_handler->handlers['field'][$id] = $handler;
      $info = array(
        'id' => $id,
        'table' => $this->table,
        'field' => $this->field . '_single',
        'label' => $lang_info->name,
      );
      $handler->langcode = $langcode;
      $handler->main_field = $options['id'];
      $handler
        ->init($this->view, $info);
      $this->language_handlers[$langcode] = $handler;
    }
  }
}