function gauth_entity_operation in Google Auth 8
Implements hook_entity_operation().
File
- ./
gauth.module, line 39 - Google Auth Api for drupal.
Code
function gauth_entity_operation(\Drupal\Core\Entity\EntityInterface $entity) {
if ($entity
->getEntityTypeId() == 'gauth') {
$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.gauth.revoke_form', array(
'gauth' => $entity
->getId(),
)) : \Drupal\Core\Url::fromRoute('gauth.response_handler', array(
'id' => $entity
->getId(),
)),
'weight' => 50,
);
return $operations;
}
}