You are here

function node_install in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/node/node.install \node_install()

Implements hook_install().

File

core/modules/node/node.install, line 121
Install, update and uninstall functions for the node module.

Code

function node_install() {

  // Enable default permissions for system roles.
  // IMPORTANT: Modules SHOULD NOT automatically grant any user role access
  // permissions in hook_install().
  // However, the 'access content' permission is a very special case, since
  // there is hardly a point in installing the Node module without granting
  // these permissions. Doing so also allows tests to continue to operate as
  // expected without first having to manually grant these default permissions.
  if (\Drupal::moduleHandler()
    ->moduleExists('user')) {
    user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, array(
      'access content',
    ));
    user_role_grant_permissions(RoleInterface::AUTHENTICATED_ID, array(
      'access content',
    ));
  }

  // Populate the node access table.
  db_insert('node_access')
    ->fields(array(
    'nid' => 0,
    'gid' => 0,
    'realm' => 'all',
    'grant_view' => 1,
    'grant_update' => 0,
    'grant_delete' => 0,
  ))
    ->execute();
}