function Attribute::GetCandidateFiles in Realistic Dummy Content 8
Get all candidate files for a given field for this entity.
Return value
An empty array if an error occurred, or if there are no files; otherwise an array of files is returned; the array might not contain all files in case an error occurred.
1 call to Attribute::GetCandidateFiles()
- Attribute::Change in api/
src/ attributes/ Attribute.php - Changes this attribute by looking for data in files.
File
- api/
src/ attributes/ Attribute.php, line 185 - Define autoload class.
Class
- Attribute
- Represents either a field or a property for an entity.
Namespace
Drupal\realistic_dummy_content_api\attributesCode
function GetCandidateFiles() {
$files = array();
try {
$moduleHandler = \Drupal::moduleHandler();
$modules = $moduleHandler
->getModuleList();
foreach ($modules as $module) {
$filepath = DRUPAL_ROOT . '/' . Environment::drupalGetPath('module', $module
->getName()) . '/realistic_dummy_content/fields/' . $this
->GetEntityType() . '/' . $this
->GetBundle() . '/' . $this
->GetName();
$files = array_merge($files, Environment::GetAllFileGroups($filepath, $this
->GetExtensions()));
}
return $files;
} catch (Exception $e) {
return $files;
}
}