protected static function Attach::getDirectory in FileField Sources 8
Get directory from settings.
Parameters
array $settings: Attach source's settings.
object $account: User to replace token.
Return value
string Path that contains files to attach.
2 calls to Attach::getDirectory()
- Attach::filePathValidate in src/Plugin/ FilefieldSource/ Attach.php 
- Validate file path.
- Attach::process in src/Plugin/ FilefieldSource/ Attach.php 
- Process callback for file field source plugin.
File
- src/Plugin/ FilefieldSource/ Attach.php, line 214 
Class
- Attach
- A FileField source plugin to allow use of files within a server directory.
Namespace
Drupal\filefield_sources\Plugin\FilefieldSourceCode
protected static function getDirectory(array $settings, $account = NULL) {
  $account = isset($account) ? $account : \Drupal::currentUser();
  $path = $settings['path'];
  $absolute = !empty($settings['absolute']);
  // Replace user level tokens.
  // Node level tokens require a lot of complexity like temporary storage
  // locations when values don't exist. See the filefield_paths module.
  if (\Drupal::moduleHandler()
    ->moduleExists('token')) {
    $token = \Drupal::token();
    $path = $token
      ->replace($path, [
      'user' => $account,
    ]);
  }
  return $absolute ? $path : \Drupal::config('system.file')
    ->get('default_scheme') . '://' . $path;
}