Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
magento2-base
dev
tests
integration
testsuite
Magento
Widget
_files
new_widget.php
Go to the documentation of this file.
1
<?php
8
$resourceModel
=
\Magento\TestFramework\Helper\Bootstrap::getObjectManager
()
9
->get(\
Magento
\Widget\Model\
ResourceModel
\Widget\Instance::class);
10
11
$model
=
\Magento\TestFramework\Helper\Bootstrap::getObjectManager
()
12
->get(\
Magento
\Widget\Model\Widget\Instance::class);
13
14
// Set default theme as work ground for MAGETWO-63643
16
$theme
=
\Magento\TestFramework\Helper\Bootstrap::getObjectManager
()->create(
17
\
Magento
\Framework\View\Design\ThemeInterface::class
18
);
19
$theme
->load(
'Magento/luma'
,
'theme_path'
);
20
21
$model
->setData(
22
[
23
'instance_type'
=>
'Magento\\Widget\\NewSampleWidget'
,
24
'theme_id'
=>
$theme
->getId(),
25
'title'
=>
'New Sample widget title'
,
26
'store_ids'
=> [
27
0 =>
'0'
,
28
],
29
'widget_parameters'
=> [
30
'block_id'
=>
'2'
,
31
],
32
'sort_order'
=>
'0'
,
33
'page_groups'
=> [],
34
'instance_code'
=>
'new_sample_widget'
,
35
]
36
);
37
38
$resourceModel
->save(
$model
);
Magento\Catalog\Model\ResourceModel\Product
Definition:
CollectionTest.php:6
$theme
$theme
Definition:
new_widget.php:16
$model
$model
Definition:
new_widget.php:11
$resourceModel
$resourceModel
Definition:
new_widget.php:8
Magento
Magento\TestFramework\Helper\Bootstrap\getObjectManager
static getObjectManager()
Definition:
Bootstrap.php:125