Skip to main content
replaced http://drupal.stackexchange.com/ with https://drupal.stackexchange.com/
Source Link

Not a module, but you can add a custom validatoradd a custom validator that parses the string that the user put in for URL to see whether it contains the expected strings, e.g.

if (strpos($url, 'facebook.com') === 0) { ... }

Note the triple-equals is necessary with strpos because otherwise "found at position zero" (return value of 0) is falsey, and so is "not found" (no return value).

Not a module, but you can add a custom validator that parses the string that the user put in for URL to see whether it contains the expected strings, e.g.

if (strpos($url, 'facebook.com') === 0) { ... }

Note the triple-equals is necessary with strpos because otherwise "found at position zero" (return value of 0) is falsey, and so is "not found" (no return value).

Not a module, but you can add a custom validator that parses the string that the user put in for URL to see whether it contains the expected strings, e.g.

if (strpos($url, 'facebook.com') === 0) { ... }

Note the triple-equals is necessary with strpos because otherwise "found at position zero" (return value of 0) is falsey, and so is "not found" (no return value).

Source Link
beth
  • 9.1k
  • 3
  • 37
  • 86

Not a module, but you can add a custom validator that parses the string that the user put in for URL to see whether it contains the expected strings, e.g.

if (strpos($url, 'facebook.com') === 0) { ... }

Note the triple-equals is necessary with strpos because otherwise "found at position zero" (return value of 0) is falsey, and so is "not found" (no return value).