\WP_Stager_Integration\Event::get_placeholder_data(): array

Description

Get placeholder event data for block editor previews.

This method returns a sample event data array that matches the structure returned by Event::get_single_event_data(). This is used to render previews in the block editor when no actual event data is available.

Returns:

array Placeholder event data matching the structure of Event::get_single_event_data()

Information

Fileclass-event.php line 1787

Full Code

/**
 * Get placeholder event data for block editor previews.
 *
 * This method returns a sample event data array that matches the structure
 * returned by Event::get_single_event_data(). This is used to render previews
 * in the block editor when no actual event data is available.
 *
 * @return array Placeholder event data matching the structure of Event::get_single_event_data()
 */
public static function get_placeholder_data() {

    // Calculate dates relative to now
    $one_week_later             = strtotime( '+1 week 19:00:00' );
    $placeholder_img_url        = trailingslashit( \WP_Stager_Integration::url() ) . 'assets/media/img/placeholder-image.svg';
    $placeholder_video_url      = trailingslashit( \WP_Stager_Integration::url() ) . 'assets/media/img/placeholder-video.svg';
    $placeholder_audio_url      = trailingslashit( \WP_Stager_Integration::url() ) . 'assets/media/img/placeholder-audio.svg';
    $content_placeholder_text_1 = __( 'This is a placeholder text for event content that will be displayed in the block editor preview and serves as a visual example. This is where the event content will be displayed on the frontend.', 'wp-stager-integration' ) . ' Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu.';
    $content_placeholder_text_2 = 'In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui.';

    return array(
        'id'                           => 0,
        'name'                         => _x( 'Event Name Example', 'Placeholder text for an event name displayed in a block preview', 'wp-stager-integration' ),
        'subtitle'                     => _x( 'Event subtitle example text.', 'Placeholder text for an event subtitle displayed in a block preview', 'wp-stager-integration' ),
        'status'                       => Options::STAGER_EVENT_STATUS_CONFIRMED,
        'type'                         => 'EVENT',
        'text'                         => $content_placeholder_text_1 . ' ' . $content_placeholder_text_2,
        'textHtml'                     => '<p>' . $content_placeholder_text_1 . '</p><p>' . $content_placeholder_text_2 . '</p>',
        'programStartAt'               => gmdate( 'Y-m-d\TH:i:s\Z', $one_week_later ),
        'programEndAt'                 => gmdate( 'Y-m-d\TH:i:s\Z', $one_week_later + 2 * HOUR_IN_SECONDS ),
        'doorsOpenAt'                  => gmdate( 'Y-m-d\TH:i:s\Z', $one_week_later - 30 * MINUTE_IN_SECONDS ),
        'eventLabels'                  => array(
            array( 'name' => _x( 'Label Text', 'Placeholder text for an event label displayed in a block preview', 'wp-stager-integration' ) ),
            array( 'name' => _x( 'Label Text', 'Placeholder text for an event label displayed in a block preview', 'wp-stager-integration' ) ),
        ),
        'media'                        => array(
            'mainImage'        => array(
                'url'             => $placeholder_img_url,
                'alternativeText' => _x( 'Placeholder event featured image', 'Placeholder text for an event featured image displayed in a block preview', 'wp-stager-integration' ),
            ),
            'additionalImages' => array(
                array(
                    'url' => $placeholder_img_url,
                ),
                array(
                    'url' => $placeholder_img_url,
                ),
            ),
            'videoUrls'        => array(
                array(
                    'url' => $placeholder_video_url,
                ),
                array(
                    'url' => $placeholder_video_url,
                ),
            ),
            'audioUrls'        => array(
                array(
                    'url' => $placeholder_audio_url,
                ),
                array(
                    'url' => $placeholder_audio_url,
                ),
            ),
            'regularUrls'      => array(
                array( 'url' => 'https://example.com', 'label' => _x( 'Example Link', 'Placeholder text for a regular URL displayed in a block preview', 'wp-stager-integration' ) ),
            ),
        ),
        'location'                     => array(
            'name'    => _x( 'Example Venue Name', 'Placeholder text for a name of an event location displayed in a block preview', 'wp-stager-integration' ),
            'city'    => _x( 'City', 'Placeholder text for a city name of an event location displayed in a block preview', 'wp-stager-integration' ),
            'street'  => _x( 'Street 123', 'Placeholder text for a street name of an event location displayed in a block preview', 'wp-stager-integration' ),
            'zipcode' => '1234 AB',
            'country' => 'NL',
            'url'     => 'https://example.com/venue',
        ),
        'programItems'                 => array(
            array(
                'name'             => _x( 'Program Item', 'Placeholder text for a program item of an event displayed in a block preview', 'wp-stager-integration' ),
                'showtimeStartsAt' => gmdate( 'Y-m-d\TH:i:s\Z', $one_week_later ),
                'showtimeEndsAt'   => gmdate( 'Y-m-d\TH:i:s\Z', $one_week_later + 1 * HOUR_IN_SECONDS ),
                'bookingStatus'    => Options::STAGER_EVENT_STATUS_CONFIRMED,
                'space'            => array( 'name' => _x( 'Main stage', 'Placeholder text for a space name of an event venue displayed in a block preview', 'wp-stager-integration' ) ),
            ),
            array(
                'name'             => _x( 'Program Item', 'Placeholder text for a program item of an event displayed in a block preview', 'wp-stager-integration' ),
                'showtimeStartsAt' => gmdate( 'Y-m-d\TH:i:s\Z', $one_week_later + 1 * HOUR_IN_SECONDS ),
                'showtimeEndsAt'   => gmdate( 'Y-m-d\TH:i:s\Z', $one_week_later + 2 * HOUR_IN_SECONDS ),
                'bookingStatus'    => Options::STAGER_EVENT_STATUS_CONFIRMED,
                'space'            => array( 'name' => _x( 'Main stage', 'Placeholder text for a space name of an event venue displayed in a block preview', 'wp-stager-integration' ) ),
            ),
        ),
        'spotifyArtists'               => array(
            array(
                'artist'     => __( 'Artist Name', 'Placeholder text for an artist name displayed in a block preview', 'wp-stager-integration' ),
                'actType'    => 'HEADLINER',
                'spotifyUrl' => $placeholder_audio_url,
            ),
            array(
                'artist'     => __( 'Artist Name', 'Placeholder text for an artist name displayed in a block preview', 'wp-stager-integration' ),
                'actType'    => 'SUPPORTING',
                'spotifyUrl' => $placeholder_audio_url,
            ),
        ),
        'ticketGroups'                 => array(
            array(
                'name'         => _x( 'Regular Ticket', 'Placeholder text for a ticket group name displayed in a block preview', 'wp-stager-integration' ),
                'type'         => 'REGULAR',
                'priceInCents' => 2500,
                'onlineSales'  => true,
                'doorSales'    => true,
            ),
        ),
        'shopUrl'                      => 'https://example.com/tickets',
        'publicationChannelTrackerUrl' => 'https://example.com/tickets',
    );
}

💡 If you ever get stuck or have a question, please check our FAQs, our Free Integration Service, our paid Full Integration Service, or reach out to us!

Get WP Stager Integration

🎁 Limited offer: Use code WELCOME26 to get your first month for free!