PHP code example of proklung / bitrix-iblock-element-validator-bundle

1. Go to this page and download the library: Download proklung/bitrix-iblock-element-validator-bundle 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/ */

    

proklung / bitrix-iblock-element-validator-bundle example snippets


use Prokl\BitrixIblockElementValidatorBundle\Services\Exceptions\ValidateErrorException;

class ExampleCustomValidator extends AbstractBitrixPropertyValidator
{
    public function __construct(string $errorMessage)
    {
        $this->errorMessage = $errorMessage;
    }

    /**
     * @inheritDoc
     */
    public function validate($value): bool
    {
        if ($value === '[email protected]') {
            throw new ValidateErrorException(
                $this->errorMessage
            );
        }

        return true;
    }
}