bt_forum-8.x-1.x-dev/bt_forum.install

bt_forum.install
<?php

/**
 * @file
 * The install file of bt_forum module.
 */

use Drupal\taxonomy\Entity\Term;

/**
 * Implements hook_install().
 */
function bt_forum_install() {
  $controller = \Drupal::entityTypeManager()->getStorage('taxonomy_term');
  $entities = $controller->loadMultiple(array('1'));
  $controller->delete($entities);

  // Add path alias.
  \Drupal::service('path.alias_storage')->save('/app/website/content/create/forum', '/app/website/forum/create/discussion-topic', 'en');

  // Create a default forum so forum posts can be created.
  $term = Term::create(array(
    'name' => t('General discussion'),
    'description' => t('General discussion topic'),
    'parent' => array(0),
    'vid' => 'forums',
    'forum_container' => 0,
  ));
  $term->save();
}

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

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