eZ\Publish\Core\FieldType\RichText\InternalLinkValidator::validate PHP Method

validate() public method

Validates following link formats: 'ezcontent://', 'ezremote://', 'ezlocation://'.
public validate ( string $scheme, string $id ) : boolean
$scheme string
$id string
return boolean
    public function validate($scheme, $id)
    {
        try {
            switch ($scheme) {
                case 'ezcontent':
                    $this->contentService->loadContentInfo($id);
                    break;
                case 'ezremote':
                    $this->contentService->loadContentByRemoteId($id);
                    break;
                case 'ezlocation':
                    $this->locationService->loadLocation($id);
                    break;
                default:
                    throw new InvalidArgumentException($scheme, "Given scheme '{$scheme}' is not supported.");
            }
        } catch (NotFoundException $e) {
            return false;
        }
        return true;
    }
InternalLinkValidator