You are here

moderation_dashboard.install in Moderation Dashboard 8

Same filename and directory in other branches
  1. 2.0.x moderation_dashboard.install

Contains installation and update hooks for Moderation dashboard.

File

moderation_dashboard.install
View source
<?php

/**
 * @file
 * Contains installation and update hooks for Moderation dashboard.
 */

/**
 * Creates the moderation_dashboard.settings config object.
 */
function moderation_dashboard_update_8100() {
  \Drupal::configFactory()
    ->getEditable('moderation_dashboard.settings')
    ->set('redirect_on_login', TRUE)
    ->save(TRUE);
}

/**
 * Enable access condition on moderation dashboard.
 */
function moderation_dashboard_update_8101() {
  $moderation_page = \Drupal::configFactory()
    ->getEditable('page_manager.page.moderation_dashboard');
  if ($moderation_page) {
    $conditions = $moderation_page
      ->get('access_conditions');
    foreach ($conditions as $key => $condition) {
      if ($condition['id'] === 'has_moderated_content_type') {
        $conditions[$key]['enable'] = TRUE;
      }
      elseif ($condition['id'] === 'moderation_dashboard_access') {
        $conditions[$key]['enable'] = TRUE;
      }
    }
    $moderation_page
      ->set('access_conditions', $conditions)
      ->save(TRUE);
  }
}

Functions

Namesort descending Description
moderation_dashboard_update_8100 Creates the moderation_dashboard.settings config object.
moderation_dashboard_update_8101 Enable access condition on moderation dashboard.