function BinaryData::setValue
Same name in other branches
- 8.9.x core/lib/Drupal/Core/TypedData/Plugin/DataType/BinaryData.php \Drupal\Core\TypedData\Plugin\DataType\BinaryData::setValue()
- 10 core/lib/Drupal/Core/TypedData/Plugin/DataType/BinaryData.php \Drupal\Core\TypedData\Plugin\DataType\BinaryData::setValue()
- 11.x core/lib/Drupal/Core/TypedData/Plugin/DataType/BinaryData.php \Drupal\Core\TypedData\Plugin\DataType\BinaryData::setValue()
Overrides TypedData::setValue().
Supports a PHP file resource or an (absolute) stream resource URI as value.
Overrides PrimitiveBase::setValue
File
-
core/
lib/ Drupal/ Core/ TypedData/ Plugin/ DataType/ BinaryData.php, line 53
Class
- BinaryData
- The binary data type.
Namespace
Drupal\Core\TypedData\Plugin\DataTypeCode
public function setValue($value, $notify = TRUE) {
if (!isset($value)) {
$this->handle = NULL;
$this->uri = NULL;
}
elseif (is_string($value)) {
// Note: For performance reasons we store the given URI and access the
// resource upon request. See BinaryData::getValue()
$this->uri = $value;
$this->handle = NULL;
}
else {
$this->handle = $value;
}
// Notify the parent of any changes.
if ($notify && isset($this->parent)) {
$this->parent
->onChange($this->name);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.