PHP code example of codeq / advancedpublish

1. Go to this page and download the library: Download codeq/advancedpublish 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/ */

    

codeq / advancedpublish example snippets



namespace Your\Namespace;

use CodeQ\AdvancedPublish\Domain\Service\ReviewerFilterInterface;
use CodeQ\AdvancedPublish\Domain\Service\UserService;
use CodeQ\AdvancedPublish\Utility\RolesUtility;
use Neos\ContentRepository\Domain\Model\NodeInterface;
use Neos\Neos\Domain\Model\User;

class YourFilterClass implements ReviewerFilterInterface
{
    public function checkFilterConditionsForUserAndNode(User $user, NodeInterface $node): bool
    {
        $neosBackendAccount = UserService::findNeosBackendAccount($user);

        // Your custom logic to determine if the user can publish the node
        // Return true if allowed, false otherwise

        return $someCondition && RolesUtility::containsRole($neosBackendAccount->getRoles(), 'Your.Package:YourRole');
    }
}