Drupal 8  8.0.2
LinkWidget Class Reference
Inheritance diagram for LinkWidget:

Public Member Functions

 settingsForm (array $form, FormStateInterface $form_state)
 
 settingsSummary ()
 
 massageFormValues (array $values, array $form, FormStateInterface $form_state)
 
- Public Member Functions inherited from WidgetBase
 __construct ($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, array $third_party_settings)
 
 form (FieldItemListInterface $items, array &$form, FormStateInterface $form_state, $get_delta=NULL)
 
 extractFormValues (FieldItemListInterface $items, array $form, FormStateInterface $form_state)
 
 settingsForm (array $form, FormStateInterface $form_state)
 
 settingsSummary ()
 
 errorElement (array $element, ConstraintViolationInterface $error, array $form, FormStateInterface $form_state)
 
 massageFormValues (array $values, array $form, FormStateInterface $form_state)
 
- Public Member Functions inherited from PluginSettingsBase
 getSettings ()
 
 getSetting ($key)
 
 setSettings (array $settings)
 
 setSetting ($key, $value)
 
 getThirdPartySettings ($module=NULL)
 
 getThirdPartySetting ($module, $key, $default=NULL)
 
 setThirdPartySetting ($module, $key, $value)
 
 unsetThirdPartySetting ($module, $key)
 
 getThirdPartyProviders ()
 
 calculateDependencies ()
 
 onDependencyRemoval (array $dependencies)
 
- Public Member Functions inherited from PluginInspectionInterface
 getPluginId ()
 
 getPluginDefinition ()
 
- Public Member Functions inherited from WidgetInterface
 formElement (FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state)
 
- Public Member Functions inherited from WidgetBaseInterface
 flagErrors (FieldItemListInterface $items, ConstraintViolationListInterface $violations, array $form, FormStateInterface $form_state)
 

Static Public Member Functions

static defaultSettings ()
 
static validateUriElement ($element, FormStateInterface $form_state, $form)
 
static validateTitleElement (&$element, FormStateInterface $form_state, $form)
 
- Static Public Member Functions inherited from WidgetBase
static afterBuild (array $element, FormStateInterface $form_state)
 
static addMoreSubmit (array $form, FormStateInterface $form_state)
 
static addMoreAjax (array $form, FormStateInterface $form_state)
 
static getWidgetState (array $parents, $field_name, FormStateInterface $form_state)
 
static setWidgetState (array $parents, $field_name, FormStateInterface $form_state, array $field_state)
 
static isApplicable (FieldDefinitionInterface $field_definition)
 
- Static Public Member Functions inherited from PluginSettingsBase
static defaultSettings ()
 

Protected Member Functions

 supportsInternalLinks ()
 
 supportsExternalLinks ()
 
- Protected Member Functions inherited from WidgetBase
 formMultipleElements (FieldItemListInterface $items, array &$form, FormStateInterface $form_state)
 
 formSingleElement (FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state)
 
 getFieldSettings ()
 
 getFieldSetting ($setting_name)
 
 handlesMultipleValues ()
 
 isDefaultValueWidget (FormStateInterface $form_state)
 
- Protected Member Functions inherited from PluginSettingsBase
 mergeDefaults ()
 

Static Protected Member Functions

static getUriAsDisplayableString ($uri)
 
static getUserEnteredStringAsUri ($string)
 
- Static Protected Member Functions inherited from WidgetBase
static getWidgetStateParents (array $parents, $field_name)
 

Additional Inherited Members

- Protected Attributes inherited from WidgetBase
 $fieldDefinition
 
 $settings
 
- Protected Attributes inherited from PluginSettingsBase
 $settings = array()
 
 $thirdPartySettings = array()
 
 $defaultSettingsMerged = FALSE
 

Detailed Description

Plugin implementation of the 'link' widget.

( id = "link_default", label = ("Link"), field_types = { "link" } )

Member Function Documentation

static defaultSettings ( )
static

{Defines the default settings for this plugin.

Returns
array A list of default settings, keyed by the setting name.
}

Implements PluginSettingsInterface.

static getUriAsDisplayableString (   $uri)
staticprotected

Gets the URI without the 'internal:' or 'entity:' scheme.

The following two forms of URIs are transformed:

  • 'entity:' URIs: to entity autocomplete ("label (entity id)") strings;
  • 'internal:' URIs: the scheme is stripped.

This method is the inverse of ::getUserEnteredStringAsUri().

Parameters
string$uriThe URI to get the displayable string for.
Returns
string
See Also
static::getUserEnteredStringAsUri()

References Drupal\entityManager(), and EntityAutocomplete\getEntityLabels().

Here is the call graph for this function:

static getUserEnteredStringAsUri (   $string)
staticprotected

Gets the user-entered string as a URI.

The following two forms of input are mapped to URIs:

  • entity autocomplete ("label (entity id)") strings: to 'entity:' URIs;
  • strings without a detectable scheme: to 'internal:' URIs.

This method is the inverse of ::getUriAsDisplayableString().

Parameters
string$stringThe user-entered string.
Returns
string The URI, if a non-empty $uri was passed.
See Also
static::getUriAsDisplayableString()

References EntityAutocomplete\extractEntityIdFromAutocompleteInput().

Here is the call graph for this function:

massageFormValues ( array  $values,
array  $form,
FormStateInterface  $form_state 
)

{Massages the form values into the format expected for field values.

Parameters
array$valuesThe submitted form values produced by the widget.
  • If the widget does not manage multiple values itself, the array holds the values generated by the multiple copies of the $element generated by the formElement() method, keyed by delta.
  • If the widget manages multiple values, the array holds the values of the form element generated by the formElement() method.
array$formThe form structure where field elements are attached to. This might be a full form structure, or a sub-element of a larger form.
\Drupal\Core\Form\FormStateInterface$form_stateThe form state.
Returns
array An array of field values, keyed by delta.
}

Implements WidgetInterface.

settingsForm ( array  $form,
FormStateInterface  $form_state 
)

{Returns a form to configure settings for the widget.Invoked from to allow administrators to configure the widget. The field_ui module takes care of handling submitted form values.

Parameters
array$formThe form where the settings form is being included in.
\Drupal\Core\Form\FormStateInterface$form_stateThe current state of the form.
Returns
array The form definition for the widget settings.
}

Implements WidgetInterface.

References PluginSettingsBase\getSetting(), and t().

Here is the call graph for this function:

settingsSummary ( )

{Returns a short summary for the current widget settings.If an empty result is returned, a UI can still be provided to display a settings form in case the widget has configurable settings.

Returns
array A short summary of the widget settings.
}

Implements WidgetInterface.

References PluginSettingsBase\getSetting(), and t().

Here is the call graph for this function:

supportsExternalLinks ( )
protected

Indicates enabled support for link to external URLs.

Returns
bool Returns TRUE if the LinkItem field is configured to support links to external URLs, otherwise FALSE.

References WidgetBase\getFieldSetting(), and LinkItemInterface\LINK_EXTERNAL.

Here is the call graph for this function:

supportsInternalLinks ( )
protected

Indicates enabled support for link to routes.

Returns
bool Returns TRUE if the LinkItem field is configured to support links to routes, otherwise FALSE.

References WidgetBase\getFieldSetting(), and LinkItemInterface\LINK_INTERNAL.

Here is the call graph for this function:

static validateTitleElement ( $element,
FormStateInterface  $form_state,
  $form 
)
static

Form element validation handler for the 'title' element.

Conditionally requires the link title if a URL value was filled in.

References FormStateInterface\setError(), and t().

Here is the call graph for this function:

static validateUriElement (   $element,
FormStateInterface  $form_state,
  $form 
)
static

Form element validation handler for the 'uri' element.

Disallows saving inaccessible or untrusted URLs.

References FormStateInterface\setError(), FormStateInterface\setValueForElement(), and t().

Here is the call graph for this function:


The documentation for this class was generated from the following file: