/** * Add posts management column. * * @param $column_name */ public function add_content_for_posts_management_column($column_name) { global $post; if ('icl_translations' !== $column_name) { return; } $active_languages = $this->get_filtered_active_lanugages(); if (is_null($this->post_status_display)) { $this->post_status_display = new WPML_Post_Status_Display($active_languages); } unset($active_languages[$this->sitepress->get_current_language()]); foreach ($active_languages as $language_data) { $icon_html = $this->post_status_display->get_status_html($post->ID, $language_data['code']); echo $icon_html; } }
function add_content_for_posts_management_column($column_name) { if ($column_name !== 'icl_translations') { return; } global $id; $active_languages = $this->get_active_languages(); $current_language = $this->get_current_language(); foreach ($active_languages as $v) { if ($v['code'] === $current_language) { continue; } $icon_html = $this->post_status_display->get_status_html($id, $v['code']); echo $icon_html; } }
/** * @param string $lang * @param WPML_Post_Status_Display $status_display */ private function translate_option($lang, $status_display) { static $row = 0; if ($this->selected_language == $lang['code']) { return; } $row_class = $row % 2 == 0 ? 'class="icl_odd_row"' : ''; ?> <tr <?php echo $row_class; ?> > <?php $translations = $this->get_translations(); if (!isset($translations[$lang['code']])) { $row++; ?> <td style="padding-left: 4px;"> <?php echo $lang['display_name']; ?> </td> <td align="right"> <?php echo $status_display->get_status_html($this->post->ID, $lang['code']); ?> </td> <td align="right"> <?php $disabled_duplication = false; $disabled_duplication_title = esc_attr__('Create duplicate', 'sitepress'); $element_key = array('trid' => $this->trid, 'language_code' => $lang['code']); $translation_status = apply_filters('wpml_tm_translation_status', null, $element_key); echo PHP_EOL . '<!-- $translation_status = ' . $translation_status . ' -->' . PHP_EOL; if ($translation_status && $translation_status < ICL_TM_COMPLETE) { $disabled_duplication = true; if ($translation_status == ICL_TM_DUPLICATE) { $disabled_duplication_title = esc_attr__("This post is already duplicated.", 'sitepress'); } else { $disabled_duplication_title = esc_attr__("Can't create a duplicate. A translation is in progress.", 'sitepress'); } } ?> <input<?php disabled(true, $disabled_duplication); ?> type="checkbox" name="icl_dupes[]" value="<?php echo $lang['code']; ?> " title="<?php echo $disabled_duplication_title; ?> "/> </td> <?php } ?> </tr> <?php }
?> > <?php if (!isset($translations[$lang['code']]->element_id)) { ?> <?php $oddev = $oddev * -1; ?> <td style="padding-left: 4px;"> <?php echo $lang['display_name']; ?> </td> <td align="right"> <?php echo $status_display->get_status_html($post->ID, $lang['code']); ?> </td> <td align="right"> <?php // do not allow creating duplicates for posts that are being translated $ddisabled = ''; $dtitle = esc_attr__('create duplicate', 'sitepress'); if (defined('WPML_TM_VERSION')) { $translation_id = $wpdb->get_var($wpdb->prepare("\r\n SELECT translation_id FROM {$wpdb->prefix}icl_translations WHERE trid=%d AND language_code=%s", $trid, $lang['code'])); if ($translation_id) { $translation_status = $wpdb->get_var($wpdb->prepare("\r\n SELECT status FROM {$wpdb->prefix}icl_translation_status WHERE translation_id=%d", $translation_id)); if (!is_null($translation_status) && $translation_status < ICL_TM_COMPLETE) { $ddisabled = ' disabled="disabled"'; $dtitle = esc_attr__("Can't create a duplicate. A translation is in progress.", 'sitepress'); }