You are here

public function BackgroundImage::getImageFile in Background Image 8

Same name and namespace in other branches
  1. 2.x src/Entity/BackgroundImage.php \Drupal\background_image\Entity\BackgroundImage::getImageFile()
  2. 2.0.x src/Entity/BackgroundImage.php \Drupal\background_image\Entity\BackgroundImage::getImageFile()

Retrieves the image file.

Parameters

bool $parents: Flag indicating whether to use parent image if this image is not set.

Return value

\Drupal\file\FileInterface|null The image File object or NULL if it doesn't exist.

Overrides BackgroundImageInterface::getImageFile

1 call to BackgroundImage::getImageFile()
BackgroundImage::getImageHash in src/Entity/BackgroundImage.php
Retrieves the image based hash.

File

src/Entity/BackgroundImage.php, line 351

Class

BackgroundImage
Defines the Background Image entity.

Namespace

Drupal\background_image\Entity

Code

public function getImageFile($parents = TRUE) {
  $file = $this
    ->get('image')->entity;
  if (!$file && $parents && ($parent = $this
    ->getParent())) {
    $file = $parent
      ->getImageFile($parents);
  }
  return $file;
}