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

outline.install
<?php
/**
 * @file
 * Installation hooks for the Outline module.
 */

use Drupal\outline\OutlineInterface;
use Drupal\outline\Entity\Outline;
use Drupal\Core\Language\LanguageInterface;

/**
 * Implements hook_install().
 */
function outline_install() {

  /* @var $outline \Drupal\outline\OutlineInterface */

  $outlineName = 'Directory of ' . \Drupal::config('system.site')->get('name');
  $outlineDescription = 'Outline Directory for ' . \Drupal::config('system.site')->get('name');

  $outline = Outline::create([
    'name' => $outlineName,
    'description' => $outlineDescription,
    'oid' => '_DIR',
    'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
    'weight' => mt_rand(0, 10),
  ]);
  $outline->save();
}

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

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