You are here

public function DrupalClient::removeEntity in Facebook Instant Articles 8.2

Same name and namespace in other branches
  1. 3.x src/DrupalClient.php \Drupal\fb_instant_articles\DrupalClient::removeEntity()

Remove a content entity from Instant Articles.

Parameters

\Drupal\Core\Entity\ContentEntityInterface $entity: Entity to import into Instant Articles.

Return value

\Facebook\InstantArticles\Client\InstantArticleStatus Status of the response.

File

src/DrupalClient.php, line 145

Class

DrupalClient
Encapsulate Drupal-specific logic for FBIA Client.

Namespace

Drupal\fb_instant_articles

Code

public function removeEntity(ContentEntityInterface $entity) {
  $status = $this
    ->removeArticle($this->iaNormalizer
    ->entityCanonicalUrl($entity));
  if ($status
    ->getStatus() === InstantArticleStatus::SUCCESS) {
    $this->logger
      ->info($this
      ->t('Removed %label (@entity_id) from Facebook Instant Articles.', [
      '%label' => $entity
        ->label(),
      '@entity_id' => $entity
        ->id(),
    ]));
  }
  return $status;
}