You are here

function moderation_dashboard_update_8101 in Moderation Dashboard 8

Same name and namespace in other branches
  1. 2.0.x moderation_dashboard.install \moderation_dashboard_update_8101()

Enable access condition on moderation dashboard.

File

./moderation_dashboard.install, line 21
Contains installation and update hooks for Moderation dashboard.

Code

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);
  }
}