1<?php
2
3namespace Drupal\link;
4
5use Drupal\Core\Field\FieldItemInterface;
6
7/**
8 * Defines an interface for the link field item.
9 */
10interface LinkItemInterface extends FieldItemInterface {
11
12  /**
13   * Specifies whether the field supports only internal URLs.
14   */
15  const LINK_INTERNAL = 0x01;
16
17  /**
18   * Specifies whether the field supports only external URLs.
19   */
20  const LINK_EXTERNAL = 0x10;
21
22  /**
23   * Specifies whether the field supports both internal and external URLs.
24   */
25  const LINK_GENERIC = 0x11;
26
27  /**
28   * Determines if a link is external.
29   *
30   * @return bool
31   *   TRUE if the link is external, FALSE otherwise.
32   */
33  public function isExternal();
34
35  /**
36   * Gets the URL object.
37   *
38   * @return \Drupal\Core\Url
39   *   Returns a Url object.
40   */
41  public function getUrl();
42
43}
44