You are here

protected function YamlFormManagedFileBase::getFileExtensions in YAML Form 8

Get allowed file extensions for an element.

Parameters

array $element: An element.

Return value

int File extension.

3 calls to YamlFormManagedFileBase::getFileExtensions()
YamlFormManagedFileBase::getDefaultProperties in src/Plugin/YamlFormElement/YamlFormManagedFileBase.php
Only a few elements don't inherit these default properties.
YamlFormManagedFileBase::getTestValue in src/Plugin/YamlFormElement/YamlFormManagedFileBase.php
Get test value for an element.
YamlFormManagedFileBase::prepare in src/Plugin/YamlFormElement/YamlFormManagedFileBase.php
Prepare an element to be rendered within a form.

File

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

Class

YamlFormManagedFileBase
Provides a base class form 'managed_file' elements.

Namespace

Drupal\yamlform\Plugin\YamlFormElement

Code

protected function getFileExtensions(array $element = NULL) {
  $file_type = str_replace('yamlform_', '', $this
    ->getPluginId());

  // Set valid file extensions.
  $file_extensions = \Drupal::config('yamlform.settings')
    ->get("file.default_{$file_type}_extensions");
  if (!empty($element['#file_extensions'])) {
    $file_extensions = $element['#file_extensions'];
  }
  return $file_extensions;
}