You are here

public function TweetEntity::deleteProfileImage in Tweet Feed 4.x

File

src/Entity/TweetEntity.php, line 459

Class

TweetEntity
Defines the Tweet Feed Tweet entity.

Namespace

Drupal\tweet_feed\Entity

Code

public function deleteProfileImage() : void {
  $files = $this
    ->get('profile_image')
    ->getValue();
  if (!empty($files)) {
    foreach ($files as $file) {
      $fo = File::load($file['target_id']);
      if (!empty($fo)) {
        $fo
          ->delete();
      }
    }
  }
}