You are here

public function FBAutopostEntity::remoteEntityDelete in Facebook Autopost 7

Deletes a publication from facebook stored in an entity.

Parameters

FacebookPublicationEntity $publication: The fully loaded Facebook publication entity.

Return value

boolean TRUE if the publication was deleted successfully.

Throws

FBAutopostException

See also

FBAutopost::remoteDelete()

1 call to FBAutopostEntity::remoteEntityDelete()
FBAutopostEntity::remoteEntityEdit in fb_autopost_entity/class/FBAutopostEntity.php
Edits a publication in facebook from a stored entity.

File

fb_autopost_entity/class/FBAutopostEntity.php, line 51
Handles the Entity publication.

Class

FBAutopostEntity
Handles publishing using a Facebook publication entity.

Code

public function remoteEntityDelete(FacebookPublicationEntity $publication) {

  // Get a wrapper for the entity and extract the remote ID.
  $wrapper = entity_metadata_wrapper('facebook_publication', $publication);
  $remote_id = $wrapper->facebook_id
    ->value();

  // If there is a remote ID in return, then delete the associated
  // publication.
  if (!empty($remote_id)) {
    return parent::remoteDelete($remote_id);
  }
  else {
    throw new FBAutopostException(t('Remote ID could not be found.'), FBAutopost::missing_param, WATCHDOG_ERROR);
  }
}