You are here

view_unpublished.install in view_unpublished 8

Contains install and update functions for view_unpublished.

File

view_unpublished.install
View source
<?php

/**
 * @file
 * Contains install and update functions for view_unpublished.
 */
use Drupal\Core\Url;

/**
 * Implements hook_install().
 */
function view_unpublished_install() {
  Drupal::service('view_unpublished.install_helper')
    ->flagRebuild();
}

/**
 * Implements hook_uninstall().
 */
function view_unpublished_uninstall() {
  Drupal::service('view_unpublished.install_helper')
    ->flagRebuild();

  // Remove any errant view_unpublished dependency.
  Drupal::service('view_unpublished.install_helper')
    ->removeDependency();
}

/**
 * Make a node access permissions rebuild needed to fix multilingual grants.
 */
function view_unpublished_update_8001() {

  // We can't just rebuild all the permissions in the update batch because of
  // https://www.drupal.org/node/2785155 and the ability to run updates using
  // the update_free_access setting.
  node_access_needs_rebuild(TRUE);
  return t('A rebuild of node access permissions is necessary. Rebuilding may take some time if there is a lot of content or complex permission settings. After rebuilding has completed, content will automatically use the new permissions. <a href=":rebuild">Rebuild permissions</a>', [
    ':rebuild' => Url::fromRoute('node.configure_rebuild_confirm')
      ->toString(),
  ]);
}

/**
 * Remove any view_unpublished dependency that may have been added to views.
 */
function view_unpublished_update_8002() {
  Drupal::service('view_unpublished.install_helper')
    ->removeDependency();
}

Functions

Namesort descending Description
view_unpublished_install Implements hook_install().
view_unpublished_uninstall Implements hook_uninstall().
view_unpublished_update_8001 Make a node access permissions rebuild needed to fix multilingual grants.
view_unpublished_update_8002 Remove any view_unpublished dependency that may have been added to views.