Usage

This page describes how the Presentation Preview plugin works and how to use it.

This plugin is meant to be activated on a network level. Log in to "Network Admin -> plugins" to activate the plugin for all sites. The plugin will then expose its API endpoint for previews.

The "API endpoint" is compatible with the Presentation Preview plugin in Dashboard

Adding support for article preview to your theme.

The plugin will load the file previews/single-article.php in the currently active theme. The plugin will also look for this file in a parent theme if WordPress theme inheritance is used.

From this file, the variable $previewData will be available. Here you will be able to find the data sent to the endpoint. The variable will implement \Everyware\Plugin\PresentationPreview\Contracts\PreviewData.

ex.

use \Everyware\Plugin\PresentationPreview\Contracts\PreviewData;

if (isset($previewData) && $previewData instanceof PreviewData) {

    // This is where the article page should be rendered.
}

The basic data you will need is the article body from the content. This should be the NewsML body of the article. You will find it as BodyRaw in a public Open Content.

use \Everyware\Plugin\PresentationPreview\Contracts\PreviewData;

if (isset($previewData) && $previewData instanceof PreviewData) {

    echo 'Content:' . $previewData->getContent();
}

You may also fetch any related material such as Concepts and Articles.

use \Everyware\Plugin\PresentationPreview\Contracts\PreviewData;

if (isset($previewData) && $previewData instanceof PreviewData) {

    $articleUuids = $previewData->getRelatedArticles();
    $conceptUuids = $previewData->getRelatedConcepts();  
}

The Imengine URI can also be fetched through this interface.

use \Everyware\Plugin\PresentationPreview\Contracts\PreviewData;

if (isset($previewData) && $previewData instanceof PreviewData) {

    $uri = $previewData->getImengineUri();
}

You can use the getMetaData method to get hold of any other data that might be sent to the API. This method will return an array of all the meta.

use \Everyware\Plugin\PresentationPreview\Contracts\PreviewData;

if (isset($previewData) && $previewData instanceof PreviewData) {

    $meta = $previewData->getMetaData();
    
}

Last updated