Added validateUrl optional flag for create/edit short URLs

This commit is contained in:
Alejandro Celaya
2020-09-23 19:19:17 +02:00
parent 1f78f5266a
commit d5eac3b1c3
11 changed files with 71 additions and 29 deletions

View File

@@ -27,6 +27,7 @@ class ShortUrlMetaInputFilter extends InputFilter
public const DOMAIN = 'domain';
public const SHORT_CODE_LENGTH = 'shortCodeLength';
public const LONG_URL = 'longUrl';
public const VALIDATE_URL = 'validateUrl';
public function __construct(array $data)
{
@@ -64,6 +65,8 @@ class ShortUrlMetaInputFilter extends InputFilter
$this->add($this->createBooleanInput(self::FIND_IF_EXISTS, false));
$this->add($this->createInput(self::VALIDATE_URL, false));
$domain = $this->createInput(self::DOMAIN, false);
$domain->getValidatorChain()->attach(new Validation\HostAndPortValidator());
$this->add($domain);