You are here

public function SearchByPageTesterTest::search_by_page_test_node_access_records in Search by Page 8

Implements hook_node_access_records().

Sets up node access for testing purposes. If a node is marked "test_private", it is only available to users with 'view test private content' permissions. Code taken form the Node Access Example module on drupal.org.

File

tests/src/Functional/SearchByPageTesterTest.php, line 226
General Functional Tests for the Search by Page module. By Jennifer Hodgdon of Poplar ProductivityWare, www.poplarware.com

Class

SearchByPageTesterTest
Base class for testing Search by Page.

Namespace

Drupal\Tests\search_by_page\Functional

Code

public function search_by_page_test_node_access_records($node) {

  // Only restrict access to nodes marked private
  if ($node->test_private) {
    $grants = array();
    $grants[] = array(
      'realm' => 'search_by_page_test',
      'gid' => 888,
      'grant_view' => 1,
      'grant_update' => 0,
      'grant_delete' => 0,
      'priority' => 999,
    );
    return $grants;
  }
}