$file = DrupalfileEntityFile::load(123); /** @var DrupalfileFileInterface $file */ $file_relative_url = $file->createFileUrl(); // /sites/default/files/example.jpg $file_absolute_url = $file->createFileUrl(FALSE); // http://example.com/sites/default/files/example.jpg $file_uri = $file->getFileUri(); // public://example.jpg
Similar Posts:
- url without www and http to https in drupal 8/9
- How to create custom block in Drupal 8 programmatically
- How to apply Drupal Patch
- create media entities and attach them to paragraphs in Drupal 8 & 9
- how to Programmatically update an entity reference field in Drupal 8 & 9
2,491