You are here

public function YamlFormManagedFileBase::getDefaultProperties in YAML Form 8

Only a few elements don't inherit these default properties.

Overrides YamlFormElementBase::getDefaultProperties

See also

\Drupal\yamlform\Plugin\YamlFormElement\Textarea

\Drupal\yamlform\Plugin\YamlFormElement\YamlFormLikert

\Drupal\yamlform\Plugin\YamlFormElement\YamlFormCompositeBase

\Drupal\yamlform\Plugin\YamlFormElement\ContainerBase

File

src/Plugin/YamlFormElement/YamlFormManagedFileBase.php, line 28

Class

YamlFormManagedFileBase
Provides a base class form 'managed_file' elements.

Namespace

Drupal\yamlform\Plugin\YamlFormElement

Code

public function getDefaultProperties() {
  $max_filesize = \Drupal::config('yamlform.settings')
    ->get('file.default_max_filesize') ?: file_upload_max_size();
  $max_filesize = Bytes::toInt($max_filesize);
  $max_filesize = $max_filesize / 1024 / 1024;
  $file_extensions = $this
    ->getFileExtensions();
  return parent::getDefaultProperties() + [
    'multiple' => FALSE,
    'max_filesize' => $max_filesize,
    'file_extensions' => $file_extensions,
    'uri_scheme' => 'private',
  ];
}