Drupal 8  8.0.2
FileWidget Class Reference
Inheritance diagram for FileWidget:

Public Member Functions

 __construct ($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, array $third_party_settings, ElementInfoManagerInterface $element_info)
 
 settingsForm (array $form, FormStateInterface $form_state)
 
 settingsSummary ()
 
 formElement (FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state)
 
 massageFormValues (array $values, array $form, FormStateInterface $form_state)
 
 flagErrors (FieldItemListInterface $items, ConstraintViolationListInterface $violations, 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 create (ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition)
 
static defaultSettings ()
 
static value ($element, $input=FALSE, FormStateInterface $form_state)
 
static validateMultipleCount ($element, FormStateInterface $form_state, $form)
 
static process ($element, FormStateInterface $form_state, $form)
 
static processMultiple ($element, FormStateInterface $form_state, $form)
 
static submit ($form, FormStateInterface $form_state)
 
- 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

 formMultipleElements (FieldItemListInterface $items, array &$form, FormStateInterface $form_state)
 
- 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 getDescriptionFromElement ($element)
 
- 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 'file_generic' widget.

( id = "file_generic", label = ("File"), field_types = { "file" } )

Constructor & Destructor Documentation

__construct (   $plugin_id,
  $plugin_definition,
FieldDefinitionInterface  $field_definition,
array  $settings,
array  $third_party_settings,
ElementInfoManagerInterface  $element_info 
)

{}

Member Function Documentation

static create ( ContainerInterface  $container,
array  $configuration,
  $plugin_id,
  $plugin_definition 
)
static

{Creates an instance of the plugin.

Parameters
\Symfony\Component\DependencyInjection\ContainerInterface$containerThe container to pull out services used in the plugin.
array$configurationA configuration array containing information about the plugin instance.
string$plugin_idThe plugin ID for the plugin instance.
mixed$plugin_definitionThe plugin implementation definition.
Returns
static Returns an instance of this plugin.
}

Implements ContainerFactoryPluginInterface.

static defaultSettings ( )
static

{Defines the default settings for this plugin.

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

Implements PluginSettingsInterface.

flagErrors ( FieldItemListInterface  $items,
ConstraintViolationListInterface  $violations,
array  $form,
FormStateInterface  $form_state 
)

{}

formElement ( FieldItemListInterface  $items,
  $delta,
array  $element,
array &  $form,
FormStateInterface  $form_state 
)

{}

References WidgetBase\getFieldSettings(), PluginSettingsBase\getSetting(), and Drupal\service().

Here is the call graph for this function:

formMultipleElements ( FieldItemListInterface  $items,
array &  $form,
FormStateInterface  $form_state 
)
protected

Overrides ::formMultipleElements().

Special handling for draggable multiple widgets and 'add more' button.

References FieldStorageDefinitionInterface\CARDINALITY_UNLIMITED, FieldFilteredMarkup\create(), WidgetBase\formSingleElement(), WidgetBase\getFieldSetting(), WidgetBase\getFieldSettings(), and t().

Here is the call graph for this function:

static getDescriptionFromElement (   $element)
staticprotected

Retrieves the file description from a field field element.

This helper static method is used by processMultiple() method.

Parameters
array$elementAn associative array with the element being processed.
Returns
array|false A description of the file suitable for use in the administrative interface.
massageFormValues ( array  $values,
array  $form,
FormStateInterface  $form_state 
)

{}

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

Form API callback: Processes a file_generic field element.

Expands the file_generic type to include the description and display fields.

This method is assigned as a process callback in formElement() method.

References Element\children(), Drupal\config(), NestedArray\getValue(), and t().

Here is the call graph for this function:

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

Form API callback: Processes a group of file_generic field elements.

Adds the weight field to each row so it can be ordered and adds a new Ajax wrapper around the entire group so it can be replaced all at once.

This method on is assigned as a process callback in formMultipleElements() method.

References Element\children(), and t().

Here is the call graph for this function:

settingsForm ( array  $form,
FormStateInterface  $form_state 
)

{}

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:

static submit (   $form,
FormStateInterface  $form_state 
)
static

Form submission handler for upload/remove button of formElement().

This runs in addition to and after file_managed_file_submit().

See Also
file_managed_file_submit()

References NestedArray\getValue(), and NestedArray\setValue().

Here is the call graph for this function:

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

Form element validation callback for upload element on file widget. Checks if user has uploaded more files than allowed.

This validator is used only when cardinality not set to 1 or unlimited.

References Element\children(), Drupal\entityManager(), NestedArray\getValue(), Entity\load(), NestedArray\setValue(), and t().

Here is the call graph for this function:

static value (   $element,
  $input = FALSE,
FormStateInterface  $form_state 
)
static

Form API callback. Retrieves the value for the file_generic field element.

This method is assigned as a #value_callback in formElement() method.

References ManagedFile\valueCallback().

Here is the call graph for this function:


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