protected UnroutedUrlAssembler::buildExternalUrl($uri, array $options = [], $collect_bubbleable_metadata = FALSE)
File
- core/lib/Drupal/Core/Utility/UnroutedUrlAssembler.php, line 70
Class
- UnroutedUrlAssembler
- Provides a way to build external or non Drupal local domain URLs.
Namespace
Drupal\Core\Utility
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | protected function buildExternalUrl( $uri , array $options = [], $collect_bubbleable_metadata = FALSE) { $this ->addOptionDefaults( $options ); // Split off the fragment. if ( strpos ( $uri , '#' ) !== FALSE) { list( $uri , $old_fragment ) = explode ( '#' , $uri , 2); // If $options contains no fragment, take it over from the path. if (isset( $old_fragment ) && ! $options [ 'fragment' ]) { $options [ 'fragment' ] = '#' . $old_fragment ; } } if (isset( $options [ 'https' ])) { if ( $options [ 'https' ] === TRUE) { } elseif ( $options [ 'https' ] === FALSE) { } } // Append the query. if ( $options [ 'query' ]) { $uri .= ( strpos ( $uri , '?' ) !== FALSE ? '&' : '?' ) . UrlHelper::buildQuery( $options [ 'query' ]); } // Reassemble. $url = $uri . $options [ 'fragment' ]; return $collect_bubbleable_metadata ? ( new GeneratedUrl())->setGeneratedUrl( $url ) : $url ; } |
Please login to continue.