You are here

public function SearchByPageTesterTest::search_by_page_test_node_update in Search by Page 8

Implements hook_node_update().

Manage the "private" flag on nodes. Code taken form the Node Access Example module on drupal.org.

File

tests/src/Functional/SearchByPageTesterTest.php, line 319
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_update($node) {

  // Make sure we are saving an integer for this field!
  if (isset($node->test_private) && $node->test_private) {
    $node->test_private = 1;
  }
  else {
    $node->test_private = 0;
  }
  \Drupal::database()
    ->update('search_by_page_test_access')
    ->fields(array(
    'private' => $node->test_private,
  ))
    ->condition('nid', $node->nid)
    ->execute();
}