public function FileEntity::isWritable in File Entity (fieldable files) 8.2
Checks if a file entity is writable or not.
Return value
bool TRUE if the file is using a visible and writable stream wrapper, or FALSE otherwise.
File
- src/
Entity/ FileEntity.php, line 410
Class
- FileEntity
- Replace for the core file entity class.
Namespace
Drupal\file_entity\EntityCode
public function isWritable() {
$scheme = StreamWrapperManager::getScheme($this
->getFileUri());
$wrappers = \Drupal::service('stream_wrapper_manager')
->getWrappers(StreamWrapperInterface::WRITE_VISIBLE);
return !empty($wrappers[$scheme]);
}