123456789101112131415161718192021222324252627282930313233 |
- <?php
- /**
- * @file
- * Provides a fake search server and other help for testing purposes.
- */
- use Drupal\Core\Session\AccountInterface;
- use Drupal\node\NodeInterface;
- /**
- * Implement hook_node_grants().
- */
- function search_api_test_node_grants(AccountInterface $account, $op) {
- $grants['search_api_test'] = [$account->id()];
- return $grants;
- }
- /**
- * Implement hook_node_access_records().
- */
- function search_api_test_node_access_records(NodeInterface $node) {
- $grants[] = [
- 'realm' => 'search_api_test',
- 'gid' => $node->getOwnerId(),
- 'grant_view' => 1,
- 'grant_update' => 0,
- 'grant_delete' => 0,
- 'langcode' => $node->language()->getId(),
- ];
- return $grants;
- }
|