Same name and namespace in other branches
  1. 8.9.x core/lib/Drupal/Component/Utility/UrlHelper.php \Drupal\Component\Utility\UrlHelper::setAllowedProtocols()
  2. 9 core/lib/Drupal/Component/Utility/UrlHelper.php \Drupal\Component\Utility\UrlHelper::setAllowedProtocols()

Sets the allowed protocols.

Parameters

array $protocols: An array of protocols, for example http, https and irc.

6 calls to UrlHelper::setAllowedProtocols()
DrupalKernel::preHandle in core/lib/Drupal/Core/DrupalKernel.php
Helper method that does request related initialization.
LinkExternalProtocolsConstraintValidatorTest::testValidate in core/modules/link/tests/src/Unit/Plugin/Validation/Constraint/LinkExternalProtocolsConstraintValidatorTest.php
@covers ::validate @dataProvider providerValidate @runInSeparateProcess
UnroutedUrlAssembler::__construct in core/lib/Drupal/Core/Utility/UnroutedUrlAssembler.php
Constructs a new unroutedUrlAssembler object.
UrlHelperTest::testFilterBadProtocol in core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php
Tests bad protocol filtering and escaping.
UrlHelperTest::testStripDangerousProtocols in core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php
Tests dangerous URL protocol filtering.

... See full list

File

core/lib/Drupal/Component/Utility/UrlHelper.php, line 365

Class

UrlHelper
Helper class URL based methods.

Namespace

Drupal\Component\Utility

Code

public static function setAllowedProtocols(array $protocols = []) {
  static::$allowedProtocols = $protocols;
}