function google_api_client_entity_operation in Google API PHP Client 8.2
Same name and namespace in other branches
- 8.4 google_api_client.module \google_api_client_entity_operation()
- 8.3 google_api_client.module \google_api_client_entity_operation()
Implements hook_entity_operation().
File
- ./
google_api_client.module, line 27 - Google Auth Api for drupal.
Code
function google_api_client_entity_operation(\Drupal\Core\Entity\EntityInterface $entity) {
if ($entity
->getEntityTypeId() == 'google_api_client') {
$operations = array();
$is_authenticated = $entity
->getAuthenticated();
$operations['authenticate_revoke'] = array(
'title' => $is_authenticated ? t('Revoke') : t('Authenticate'),
'url' => $is_authenticated ? \Drupal\Core\Url::fromRoute('entity.google_api_client.revoke_form', array(
'google_api_client' => $entity
->getId(),
)) : \Drupal\Core\Url::fromRoute('google_api_client.callback', array(
'id' => $entity
->getId(),
)),
'weight' => 50,
);
return $operations;
}
}