PluginProbe
Polylang / trunk
Polylang vtrunk
3.8.9 3.8.8 3.8.7 3.8.6 3.8.5 3.8.4 3.8.3 2.7 2.7.0.1 2.7.1 2.7.2 2.7.3 2.7.4 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.9 2.9.1 2.9.2 3.0 3.0.1 3.0.2 3.0.3 All 233 releases
polylang / src / admin / view-translations-media.php

view-translations-media.php in Polylang trunk, at src/admin/view-translations-media.php

52 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Displays the translations fields for media
4 *
5 * @package Polylang
6 *
7 * @var PLL_Admin_Classic_Editor $this PLL_Admin_Classic_Editor object.
8 * @var PLL_Language $lang The media language. Default language if no language assigned yet.
9 * @var WP_Post $post The media object.
10 */
11
12 defined( 'ABSPATH' ) || exit;
13 ?>
14 <p><strong><?php esc_html_e( 'Translations', 'polylang' ); ?></strong></p>
15 <table>
16 <?php
17 foreach ( $this->model->get_languages_list() as $language ) {
18 if ( $language->term_id === $lang->term_id ) {
19 continue;
20 }
21
22 $translation_id = $this->model->post->get_translation( $post->ID, $language );
23 $translation = null;
24
25 if ( ! empty( $translation_id ) && $translation_id !== $post->ID ) {
26 $translation = get_post( $translation_id );
27 }
28 ?>
29 <tr>
30 <td class = "pll-media-language-column"><span class = "pll-translation-flag"><?php echo $language->get_admin_flag( 'aria-hidden' ); // phpcs:ignore WordPress.Security.EscapeOutput ?></span><?php echo esc_html( $language->name ); ?></td>
31 <td class = "pll-media-edit-column">
32 <?php
33 if ( $translation instanceof WP_Post ) {
34 // The translation exists.
35 printf(
36 '<input type="hidden" name="media_tr_lang[%s]" value="%d" />',
37 esc_attr( $language->slug ),
38 (int) $translation->ID
39 );
40 echo $this->links->get_edit_post_link_html( $translation ); // phpcs:ignore WordPress.Security.EscapeOutput
41 } else {
42 // The translation doesn't exist.
43 echo $this->links->get_new_post_link_html( $post, $language ); // phpcs:ignore WordPress.Security.EscapeOutput
44 }
45 ?>
46 </td>
47 </tr>
48 <?php
49 } // End foreach
50 ?>
51 </table>
52