Inpsyde\MultilingualPress\Relations\Post\Search\StatusAwareSearchResultsView::render PHP Метод

render() публичный Метод

Renders the markup for the search results according to the given context.
С версии: 3.0.0
public render ( RelationshipContext $context ) : void
$context Inpsyde\MultilingualPress\Relations\Post\RelationshipContext Relationship context data object.
Результат void
    public function render(RelationshipContext $context)
    {
        $posts = $this->search->get_posts($context);
        if (!$posts) {
            echo '<li>' . esc_html__('Nothing found.', 'multilingual-press') . '</li>';
            return;
        }
        $site_id = $context->remote_site_id();
        array_walk($posts, function (WP_Post $post) use($site_id) {
            printf('<li><label for="%4$s"><input type="radio" name="%2$s" value="%3$d" id="%4$s"> %1$s</label></li>', $this->get_post_title($post), esc_attr("mlp_add_post[{$site_id}]"), esc_attr($post->ID), esc_attr("mlp-rc-search-result-{$site_id}-{$post->ID}"));
        });
    }