# Usage

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](/everyware/starter-kit-packages/everyware-plugin-presentation-preview/api.md) for previews.

{% hint style="info" %}
The "API endpoint" is compatible with the [Presentation Preview plugin](https://docs.navigaglobal.com/presentation-preview/) in Dashboard
{% endhint %}

## 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.

```php
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.

```php
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`.

```php
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.

```php
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.

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

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

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.navigaglobal.com/everyware/starter-kit-packages/everyware-plugin-presentation-preview/usage.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
