public function ContentImporter::onInstall in Commerce Demo 8
Same name and namespace in other branches
- 8.2 src/ContentImporter.php \Drupal\commerce_demo\ContentImporter::onInstall()
Reacts on the module being installed, imports all content.
File
- src/
ContentImporter.php, line 65
Class
- ContentImporter
- Defines the content importer.
Namespace
Drupal\commerce_demoCode
public function onInstall() {
// It is necessary to hardcode the available entity types/bundles to ensure
// the right import order, because there is no dependency tracking.
$available_content = [
[
'taxonomy_term',
'brands',
],
[
'taxonomy_term',
'product_categories',
],
[
'taxonomy_term',
'special_categories',
],
[
'commerce_product_attribute_value',
'color',
],
[
'commerce_product_attribute_value',
'size',
],
[
'commerce_product',
'clothing',
],
[
'commerce_product',
'simple',
],
[
'commerce_shipping_method',
'',
],
[
'commerce_promotion',
'',
],
];
foreach ($available_content as $keys) {
$this
->importAll($keys[0], $keys[1]);
}
}