public static is_external ( string $url ) : boolean | ||
$url | string | |
Результат | boolean | true if $path is an external url, false if relative or local. true if it's a subdomain (http://cdn.example.org = true) |
/** * Checks to see if the menu item is an external link so if my site is `example.org`, `google.com/whatever` is an external link. Helpful when creating rules for the target of a link * @api * @example * ```twig * <a href="{{ item.link }}" target="{{ item.is_external ? '_blank' : '_self' }}"> * ``` * @return bool */ public function is_external() { if ($this->type() != 'custom') { return false; } return URLHelper::is_external($this->url); }