public function RealisticDummyContentTermReferenceField::implementValueFromFile in Realistic Dummy Content 8.2
Same name and namespace in other branches
- 7.2 api/src/includes/RealisticDummyContentTermReferenceField.php \Drupal\realistic_dummy_content_api\includes\RealisticDummyContentTermReferenceField::implementValueFromFile()
- 3.x api/src/includes/RealisticDummyContentTermReferenceField.php \Drupal\realistic_dummy_content_api\includes\RealisticDummyContentTermReferenceField::implementValueFromFile()
Given a RealisticDummyContentFileGroup object, get a structured property.
This function is not meant to called directly; rather, call ValueFromFile(). This function must be overriden by subclasses.
Parameters
object $file: An object of type RealisticDummyContentFileGroup.
Return value
null|array Returns structured data to be added to the entity object, or NULL if such data can't be creatd.
Throws
\Exception.
Overrides RealisticDummyContentAttribute::implementValueFromFile
File
- api/
src/ includes/ RealisticDummyContentTermReferenceField.php, line 18
Class
- RealisticDummyContentTermReferenceField
- Represents a term reference field.
Namespace
Drupal\realistic_dummy_content_api\includesCode
public function implementValueFromFile($file) {
try {
$termname = $file
->value();
if ($termname) {
$return = Framework::instance()
->formatProperty('tid', $this
->getTid($termname));
return $return;
}
} catch (\Exception $e) {
Framework::instance()
->debug('Problem with taxonomy term: ' . $e
->getMessage());
return NULL;
}
}