# marqueex/0.6.0/includes/Integrations/Gutenberg/Render/PostSource.php

MarqueeX – Smooth Marquee Slider, News Ticker &amp; Post Marquee for Block Editor &amp; Elementor, version 0.6.0. 63 lines.

- Page: https://pluginprobe.com/plugins/marqueex/0.6.0/code/includes/Integrations/Gutenberg/Render/PostSource.php
- Raw: https://pluginprobe.com/plugins/marqueex/0.6.0/raw/includes/Integrations/Gutenberg/Render/PostSource.php
- Modified: 2026-09-12T09:56:54+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/marqueex/0.6.0/code/includes/Integrations/Gutenberg/Render/PostSource.php#L10-L20`.

```php
<?php

namespace Wpxero\Marqueex\Integrations\Gutenberg\Render;

use Wpxero\Marqueex\Traits\MarqueeSource;
use Wpxero\Marqueex\Traits\Singleton;

if (!defined('ABSPATH')) {
    exit;
}

/**
 * Post-source helper for dynamic MarqueeX Gutenberg blocks.
 *
 * Wraps the shared {@see MarqueeSource} trait (the same query/duplication/url
 * logic the Elementor widgets use) and exposes a small, Elementor-free surface
 * the block `render.php` files can call. Keeping this in the Gutenberg namespace
 * means the dynamic blocks never depend on Elementor being installed.
 */
class PostSource {
    use Singleton;
    use MarqueeSource;

    /**
     * Run the marquee post query for a block's `query` attribute and return a
     * list padded to the minimum needed for a seamless loop.
     *
     * @param array $query Block `query` attribute (postType, postsPerPage, orderby, order, categoryIds).
     * @return \WP_Post[]
     */
    public function get_posts(array $query) {
        $args = $this->get_query_args([
            'post_type'      => $query['postType'] ?? 'post',
            'posts_per_page' => $query['postsPerPage'] ?? 6,
            'orderby'        => $query['orderby'] ?? 'date',
            'order'          => $query['order'] ?? 'desc',
            'category_ids'   => $query['categoryIds'] ?? [],
        ]);

        return $this->ensure_minimum_posts(get_posts($args));
    }

    /**
     * Pad a custom item list to the minimum needed for a seamless loop.
     *
     * @param array $items
     * @return array
     */
    public function pad_items(array $items) {
        return $this->ensure_minimum_posts($items);
    }

    /**
     * Resolve the public URL for a post, honoring custom URLs.
     *
     * @param \WP_Post $post
     * @return string
     */
    public function url($post) {
        return $this->get_post_url($post);
    }
}

```
