PHP code example of toastnz / open-cms-preview

1. Go to this page and download the library: Download toastnz/open-cms-preview library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

toastnz / open-cms-preview example snippets

 php
use Toast\OpenCmsPreview\Fields\OpenCmsPreview;

public function getCMSFields()
{
    $fields = parent::getCMSFields();

    $fields->addFieldsToTab('Root.Main', [
        OpenCmsPreview::create($this->getPreviewLink());
    ]);

    return $fields;
}

public function getPreviewLink()
{
    // Return the link to the page you want to preview
}