Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. LinkItemInterface.php

interface LinkItemInterface

Defines an interface for the link field item.

Hierarchy

  • interface \Drupal\Core\TypedData\TypedDataInterface
    • interface \Drupal\Core\TypedData\TraversableTypedDataInterface extends \Drupal\Core\TypedData\TypedDataInterface \Drupal\Core\TypedData\Traversable
      • interface \Drupal\Core\TypedData\ComplexDataInterface extends \Drupal\Core\TypedData\TraversableTypedDataInterface
        • interface \Drupal\Core\Field\FieldItemInterface extends \Drupal\Core\TypedData\ComplexDataInterface
          • interface \Drupal\link\LinkItemInterface extends \Drupal\Core\Field\FieldItemInterface

Expanded class hierarchy of LinkItemInterface

All classes that implement LinkItemInterface

6 files declare their use of LinkItemInterface
LinkFormatter.php in core/modules/link/src/Plugin/Field/FieldFormatter/LinkFormatter.php
LinkItem.php in core/modules/link/src/Plugin/Field/FieldType/LinkItem.php
LinkTypeConstraintValidator.php in core/modules/link/src/Plugin/Validation/Constraint/LinkTypeConstraintValidator.php
LinkWidget.php in core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php
MenuLinkContent.php in core/modules/menu_link_content/src/Entity/MenuLinkContent.php

... See full list

File

core/modules/link/src/LinkItemInterface.php, line 10

Namespace

Drupal\link
View source
interface LinkItemInterface extends FieldItemInterface {
    
    /**
     * Specifies whether the field supports only internal URLs.
     */
    const LINK_INTERNAL = 0x1;
    
    /**
     * Specifies whether the field supports only external URLs.
     */
    const LINK_EXTERNAL = 0x10;
    
    /**
     * Specifies whether the field supports both internal and external URLs.
     */
    const LINK_GENERIC = 0x11;
    
    /**
     * Determines if a link is external.
     *
     * @return bool
     *   TRUE if the link is external, FALSE otherwise.
     */
    public function isExternal();
    
    /**
     * Gets the URL object.
     *
     * @return \Drupal\Core\Url
     *   Returns a Url object.
     *
     * @throws \InvalidArgumentException
     *   Thrown when there is a problem with field data.
     */
    public function getUrl();
    
    /**
     * Gets the link title.
     *
     * @return string|null
     *   Returns the link title.
     */
    public function getTitle() : ?string;

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
ComplexDataInterface::get public function Gets a property object. 2
ComplexDataInterface::getDataDefinition public function Gets the data definition. Overrides TypedDataInterface::getDataDefinition
ComplexDataInterface::getProperties public function Gets an array of property objects. 3
ComplexDataInterface::isEmpty public function Determines whether the data structure is empty. 2
ComplexDataInterface::set public function Sets a property value. 3
ComplexDataInterface::toArray public function Returns an array of all property values. 2
FieldItemInterface::calculateDependencies public static function Calculates dependencies for field items. 1
FieldItemInterface::calculateStorageDependencies public static function Calculates dependencies for field items on the storage level. 1
FieldItemInterface::defaultFieldSettings public static function Defines the field-level settings for this plugin. 1
FieldItemInterface::defaultStorageSettings public static function Defines the storage-level settings for this plugin. 1
FieldItemInterface::delete public function Defines custom delete behavior for field values. 1
FieldItemInterface::deleteRevision public function Defines custom revision delete behavior for field values. 1
FieldItemInterface::fieldSettingsForm public function Returns a form for the field-level settings. 1
FieldItemInterface::fieldSettingsFromConfigData public static function Returns a settings array in the field type's canonical representation. 1
FieldItemInterface::fieldSettingsSummary public static function Returns a short summary of the field's field-level settings. 1
FieldItemInterface::fieldSettingsToConfigData public static function Returns a settings array that can be stored as a configuration value. 1
FieldItemInterface::generateSampleValue public static function Generates placeholder field values. 1
FieldItemInterface::getEntity public function Gets the entity that field belongs to. 1
FieldItemInterface::getFieldDefinition public function Gets the field definition. 1
FieldItemInterface::getLangcode public function Gets the langcode of the field values held in the object. 1
FieldItemInterface::mainPropertyName public static function Returns the name of the main property, if any. 1
FieldItemInterface::onDependencyRemoval public static function Informs the plugin that a dependency of the field will be deleted. 1
FieldItemInterface::postSave public function Defines custom post-save behavior for field values. 1
FieldItemInterface::preSave public function Defines custom presave behavior for field values. 1
FieldItemInterface::propertyDefinitions public static function Defines field item properties. 19
FieldItemInterface::schema public static function Returns the schema for the field. 22
FieldItemInterface::storageSettingsForm public function Returns a form for the storage-level settings. 1
FieldItemInterface::storageSettingsFromConfigData public static function Returns a settings array in the field type's canonical representation. 1
FieldItemInterface::storageSettingsSummary public static function Returns a short summary of the field's storage-level settings. 1
FieldItemInterface::storageSettingsToConfigData public static function Returns a settings array that can be stored as a configuration value. 1
FieldItemInterface::view public function Returns a renderable array for a single field item. 1
FieldItemInterface::__get public function Magic method: Gets a property value. 1
FieldItemInterface::__isset public function Magic method: Determines whether a property is set. 1
FieldItemInterface::__set public function Magic method: Sets a property value. 1
FieldItemInterface::__unset public function Magic method: Unsets a property. 1
LinkItemInterface::getTitle public function Gets the link title. 1
LinkItemInterface::getUrl public function Gets the URL object. 1
LinkItemInterface::isExternal public function Determines if a link is external. 1
LinkItemInterface::LINK_EXTERNAL constant Specifies whether the field supports only external URLs.
LinkItemInterface::LINK_GENERIC constant Specifies whether the field supports both internal and external URLs.
LinkItemInterface::LINK_INTERNAL constant Specifies whether the field supports only internal URLs.
TraversableTypedDataInterface::onChange public function React to changes to a child property or item. 4
TypedDataInterface::applyDefaultValue public function Applies the default value. 1
TypedDataInterface::createInstance public static function Constructs a TypedData object given its definition and context. 1
TypedDataInterface::getConstraints public function Gets a list of validation constraints. 1
TypedDataInterface::getName public function Returns the name of a property or item. 1
TypedDataInterface::getParent public function Returns the parent data structure; i.e. either complex data or a list. 1
TypedDataInterface::getPropertyPath public function Returns the property path of the data. 1
TypedDataInterface::getRoot public function Returns the root of the typed data tree. 1
TypedDataInterface::getString public function Returns a string representation of the data. 1
TypedDataInterface::getValue public function Gets the data value. 1
TypedDataInterface::setContext public function Sets the context of a property or item via a context aware parent. 1
TypedDataInterface::setValue public function Sets the data value. 1
TypedDataInterface::validate public function Validates the currently set data value. 1

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal