You are here

public function BackgroundImage::getParent in Background Image 8

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

Retrieves the parent background image, if one exists.

Return value

\Drupal\background_image\BackgroundImageInterface|null

Overrides BackgroundImageInterface::getParent

2 calls to BackgroundImage::getParent()
BackgroundImage::getImageFile in src/Entity/BackgroundImage.php
Retrieves the image file.
BackgroundImage::getSettings in src/Entity/BackgroundImage.php
Retrieves the settings for this background image.

File

src/Entity/BackgroundImage.php, line 383

Class

BackgroundImage
Defines the Background Image entity.

Namespace

Drupal\background_image\Entity

Code

public function getParent() {
  if (!isset($this->parent)) {
    $this->parent = FALSE;
    if (($target_entity = $this
      ->getTargetEntity()) && ($this->parent = $this
      ->getBackgroundImageManager()
      ->getEntityBundleBackgroundImage($target_entity))) {
      return $this->parent;
    }
    else {
      if ($this
        ->getType() !== self::TYPE_GLOBAL) {
        $this->parent = $this
          ->getBackgroundImageManager()
          ->getGlobalBackgroundImage() ?: FALSE;
      }
    }
  }
  return $this->parent;
}