dcco-8.x-3.x-dev/modules/dcco_store/dcco_store.install

modules/dcco_store/dcco_store.install
<?php

/**
 * @file
 * Install, update, and uninstall scripts.
 */

use Drupal\commerce_store\Entity\Store;

/**
 * Implements hook_install().
 */
function dcco_store_install() {
  // Create the camp store.
  $address = [
    'country_code' => 'US',
    'address_line1' => '535 16th St',
    'address_line2' => 'Suite 900',
    'locality' => 'Denver',
    'administrative_area' => 'CO',
    'postal_code' => '80202',
  ];

  $currency = 'USD';

  $store = Store::create([
    'type' => 'online',
    'uid' => 1,
    'name' => 'DrupalCamp Colorado',
    'mail' => 'info@drupalcampcolorado.org',
    'address' => $address,
    'default_currency' => $currency,
    'billing_countries' => ['US'],
  ]);
  $store->save();

  // Set the store as the default store.
  \Drupal::service('entity_type.manager')
    ->getStorage('commerce_store')
    ->markAsDefault($store);
}

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

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