You are here

public function FlagServiceInterface::getFlaggableById in Flag 8.4

Loads the flaggable entity given the flag entity and entity ID.

$flag = \Drupal::service('flag')
  ->getFlagById('bookmark');
$flaggable = \Drupal::service('flag')
  ->getFlaggableById($flag, $entity_id);

Parameters

\Drupal\flag\FlagInterface $flag: The flag entity.

int $entity_id: The ID of the flaggable entity.

Return value

\Drupal\Core\Entity\EntityInterface|null The flaggable entity object.

1 method overrides FlagServiceInterface::getFlaggableById()
FlagService::getFlaggableById in src/FlagService.php
Loads the flaggable entity given the flag entity and entity ID.

File

src/FlagServiceInterface.php, line 161

Class

FlagServiceInterface
Flag service interface.

Namespace

Drupal\flag

Code

public function getFlaggableById(FlagInterface $flag, $entity_id);