Commit 69be11eb authored by alexpott's avatar alexpott

Issue #2326875 by tim.plunkett, iMiksu | almaudoh: Convert file_element_info() to Element classes.

parent 1b06ce86
This diff is collapsed.
This diff is collapsed.
......@@ -14,6 +14,7 @@
use Drupal\Core\Field\WidgetBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Element;
use Drupal\file\Element\ManagedFile;
/**
* Plugin implementation of the 'file_generic' widget.
......@@ -289,7 +290,7 @@ public static function value($element, $input = FALSE, FormStateInterface $form_
}
// We depend on the managed file element to handle uploads.
$return = file_managed_file_value($element, $input, $form_state);
$return = ManagedFile::valueCallback($element, $input, $form_state);
// Ensure that all the required properties are returned even if empty.
$return += array(
......
......@@ -406,7 +406,10 @@ protected function defaultImageForm(array &$element, array $settings) {
'#description' => t('Image to be shown if no image is uploaded.'),
'#default_value' => empty($settings['default_image']['fid']) ? array() : array($settings['default_image']['fid']),
'#upload_location' => $settings['uri_scheme'] . '://default_images/',
'#element_validate' => array('file_managed_file_validate', array(get_class($this), 'validateDefaultImageForm')),
'#element_validate' => array(
'\Drupal\file\Element\ManagedFile::validateManagedFile',
array(get_class($this), 'validateDefaultImageForm'),
),
'#upload_validators' => $this->getUploadValidators(),
);
$element['default_image']['alt'] = array(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment