Inpsyde\MultilingualPress\Widget\Dashboard\UntranslatedPosts\PostRepository::is_post_translated PHP Method

is_post_translated() public method

Checks if the post with the given ID has been translated.
Since: 3.0.0
public is_post_translated ( integer $post_id ) : boolean
$post_id integer Optional. Post ID. Defaults to 0.
return boolean Whether or not the post with the given ID has been translated.
    public function is_post_translated($post_id = 0);

Usage Example

    /**
     * Renders the setting markup.
     *
     * @since   3.0.0
     * @wp-hook post_submitbox_misc_actions
     *
     * @param WP_Post $post Post object.
     *
     * @return void
     */
    public function render(WP_Post $post)
    {
        $post_id = $post->ID;
        $translated = $this->post_repository->is_post_translated($post_id);
        /**
         * Filters whether or not the checkbox for the current post should be rendered.
         *
         * @since 3.0.0
         *
         * @param bool $show_checkbox Whether or not to show the checkbox.
         * @param int  $post_id       Post ID.
         * @param bool $translated    Whether or not the post is translated.
         */
        if (!apply_filters('multilingualpress.show_translation_completed_checkbox', true, $post_id, $translated)) {
            return;
        }
        $id = 'mlp-translation-completed';
        ?>
		<div class="misc-pub-section misc-pub-mlp-translation-completed">
			<?php 
        echo \Inpsyde\MultilingualPress\nonce_field($this->nonce);
        ?>
			<label for="<?php 
        echo esc_attr($id);
        ?>
">
				<input type="checkbox" name="<?php 
        echo esc_attr(PostRepository::META_KEY);
        ?>
"
					value="1" id="<?php 
        echo esc_attr($id);
        ?>
" <?php 
        checked($translated);
        ?>
>
				<?php 
        _e('Translation completed', 'multilingual-press');
        ?>
			</label>
		</div>
		<?php 
    }