sector_blog-8.x-1.0-beta1/sector_blog.install

sector_blog.install
<?php

/**
 * @file
 * Contains install tasks for the Sector blog module.
 */

/**
 * Implements hook_install.
 *
 * Install tasks for the Sector blog module.
 *
 * Currently sets the permission to allow anonymous users to post comments.
 * Creates the default xmlsitemap settings for the blog content type.
 */
function sector_blog_install() {
  user_role_grant_permissions('anonymous', ['post comments']);

  // Check Xmlsitemap module is enabled.
  $moduleHandler = \Drupal::service('module_handler');
  if($moduleHandler->moduleExists('xmlsitemap')) {
    // Default data array for the blog content type.
    $data = [
      'status' => TRUE,
      'priority' => 0.5,
      'changefreq' => 86400,
    ];
    // Load the config and save our default data.
    \Drupal::configFactory()->getEditable("xmlsitemap.settings.node.blog_post")->setData($data)->save();
  }
}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc