PHP code example of sherlockode / sylius-advanced-content-plugin

1. Go to this page and download the library: Download sherlockode/sylius-advanced-content-plugin 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/ */

    

sherlockode / sylius-advanced-content-plugin example snippets




namespace App\Acb;

use Sherlockode\AdvancedContentBundle\Model\PageInterface;
use Sherlockode\AdvancedContentBundle\Model\ScopeInterface;
use Sherlockode\SyliusAdvancedContentPlugin\Preview\ViewHandlerInterface;

class ViewHandler implements ViewHandlerInterface
{
    /**
     * @param PageInterface  $page
     * @param ScopeInterface $scope
     *
     * @return string|null
     */
    public function getViewTemplate(PageInterface $page, ScopeInterface $scope): ?string
    {
        if ('homepage' === $page->getPageIdentifier()) {
            return '@SyliusShop/Acb/homepage.html.twig';
        }
        
        return '@SyliusShop/Acb/page.html.twig';
    }
}