You are here

public function BackgroundImage::getTarget in Background Image 2.0.x

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

Retrieves the target identifier that is specific to the type.

Parameters

bool $explode: Flag indicating whether to split the target into an array based on the colon (:) delimiter. This is useful for entity based targets.

Return value

string|string[]

Overrides BackgroundImageInterface::getTarget

3 calls to BackgroundImage::getTarget()
BackgroundImage::getTargetEntity in src/Entity/BackgroundImage.php
Retrieves the target entity, if the type is supported and exists.
BackgroundImage::getTargetEntityBundle in src/Entity/BackgroundImage.php
Retrieves the target entity bundle, if the type is supported and exists.
BackgroundImage::getTargetView in src/Entity/BackgroundImage.php
Retrieves the target entity view, if the type is supported and exists.

File

src/Entity/BackgroundImage.php, line 465

Class

BackgroundImage
Defines the Background Image entity.

Namespace

Drupal\background_image\Entity

Code

public function getTarget($explode = FALSE) {
  $target = $this
    ->get('target')->value;
  return $target && $explode ? explode(':', $target) : $target;
}