Drupal 8  8.0.2
ManagedFile Class Reference
Inheritance diagram for ManagedFile:

Public Member Functions

 getInfo ()
- Public Member Functions inherited from PluginInspectionInterface
 getPluginId ()
 getPluginDefinition ()

Static Public Member Functions

static valueCallback (&$element, $input, FormStateInterface $form_state)
static processManagedFile (&$element, FormStateInterface $form_state, &$complete_form)
static preRenderManagedFile ($element)
static validateManagedFile (&$element, FormStateInterface $form_state, &$complete_form)
- Static Public Member Functions inherited from FormElement
static valueCallback (&$element, $input, FormStateInterface $form_state)
static processPattern (&$element, FormStateInterface $form_state, &$complete_form)
static validatePattern (&$element, FormStateInterface $form_state, &$complete_form)
- Static Public Member Functions inherited from RenderElement
static setAttributes (&$element, $class=array())
static preRenderGroup ($element)
static processAjaxForm (&$element, FormStateInterface $form_state, &$complete_form)
static preRenderAjaxForm ($element)
static processGroup (&$element, FormStateInterface $form_state, &$complete_form)

Static Protected Member Functions

static fileUsage ()

Detailed Description

Provides an AJAX/progress aware widget for uploading and saving a file.


Member Function Documentation

static fileUsage ( )

Wraps the file usage service.

getInfo ( )

{Returns the element properties for this element.

array An array of element properties. See ::getInfo() for documentation of the standard properties of all elements, and the return value format.

Implements ElementInterface.

static preRenderManagedFile (   $element)

Render API callback: Hides display of the upload or remove controls.

Upload controls are hidden when a file is already uploaded. Remove controls are hidden when there is no file attached. Controls are hidden here instead of in ::processManagedFile(), because #access for these buttons depends on the managed_file element's #value. See the documentation of ::doBuildForm() for more detailed information about the relationship between #process, #value, and #access.

Because #access is set here, it affects display only and does not prevent JavaScript or other untrusted code from submitting the form as though access were enabled. The form processing functions for these elements should not assume that the buttons can't be "clicked" just because they are not displayed.

See Also
static processManagedFile ( $element,
FormStateInterface  $form_state,

Render API callback: Expands the managed_file element type.

Expands the file type to include Upload and Remove buttons, as well as support for a default value.

References Url\fromRoute(), Html\getUniqueId(), Entity\loadMultiple(), Drupal\service(), and t().

Here is the call graph for this function:

static validateManagedFile ( $element,
FormStateInterface  $form_state,

Render API callback: Validates the managed_file element.

References Entity\load(), and t().

Here is the call graph for this function:

static valueCallback ( $element,
FormStateInterface  $form_state 


References Entity\load().

Referenced by FileWidget\value().

Here is the call graph for this function:

Here is the caller graph for this function:

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