function TermReferenceField::ValueFromFile_ in Realistic Dummy Content 8
Given a FileGroup object, get a structured property
This function is not meant to called directly; rather, call ValueFromFile(). This function must be overriden by subclasses.
Parameters
$file: An object of type FileGroup.
Return value
Returns structured data to be added to the entity object, or NULL if such data can't be creatd.
Throws
\Exception.
Overrides Attribute::ValueFromFile_
File
- api/
src/ attributes/ TaxonomyTermReferenceField.php, line 19 - Define autoload class.
Class
Namespace
Drupal\realistic_dummy_content_api\attributesCode
function ValueFromFile_($file) {
try {
$termname = $file
->Value();
if ($termname) {
return array(
\Drupal\Core\Language\Language::LANGCODE_NOT_SPECIFIED => array(
array(
'tid' => $this
->GetTid($termname),
),
),
);
}
} catch (\Exception $e) {
return NULL;
}
}