Magento 2 + create widget via installData Script
Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;
up vote
1
down vote
favorite
I need to custom requirement for creating a widget via Script. but I have facing an error when try to add a widget via below script
<?php
namespace TestXyzSetup;
use MagentoFrameworkSetup;
class InstallData implements SetupInstallDataInterface
/**
* @var SetupSampleDataExecutor
*/
protected $executor;
/**
* @var Installer
*/
protected $installer;
private $widgetFactory;
public function __construct(
SetupSampleDataExecutor $executor,
Installer $installer,
MagentoWidgetModelWidgetInstanceFactory $widgetFactory
)
$this->executor = $executor;
$this->installer = $installer;
$this->widgetFactory = $widgetFactory;
public function install(SetupModuleDataSetupInterface $setup, SetupModuleContextInterface $moduleContext)
$this->executor->exec($this->installer);
$instaFeedWidget = [
'instance_type' => 'TestXyzBlockWidgetInstagram',
'theme_id' => 2,
'title' => 'Instagram',
'store_ids' => '0',
'widget_parameters' => '"title":"Instagram ","numberimage":"16","resolution":"standard_resolution"',
'sort_order' => 0,
'page_groups' => [[
'page_group' => 'pages',
'all_pages' => [
'page_id' => null,
//'group' => 'all_pages',
'layout_handle' => 'cms_index_index',
'block' => 'page.bottom',
'for' => 'all',
'template' => ''
]
]]
];
$this->widgetFactory->create()->setData($instaFeedWidget)->save();
But I am facing error TestXyzSetupInstaller does not exist
Any ideas will be welcomed.
magento2 widget installdata
add a comment |Â
up vote
1
down vote
favorite
I need to custom requirement for creating a widget via Script. but I have facing an error when try to add a widget via below script
<?php
namespace TestXyzSetup;
use MagentoFrameworkSetup;
class InstallData implements SetupInstallDataInterface
/**
* @var SetupSampleDataExecutor
*/
protected $executor;
/**
* @var Installer
*/
protected $installer;
private $widgetFactory;
public function __construct(
SetupSampleDataExecutor $executor,
Installer $installer,
MagentoWidgetModelWidgetInstanceFactory $widgetFactory
)
$this->executor = $executor;
$this->installer = $installer;
$this->widgetFactory = $widgetFactory;
public function install(SetupModuleDataSetupInterface $setup, SetupModuleContextInterface $moduleContext)
$this->executor->exec($this->installer);
$instaFeedWidget = [
'instance_type' => 'TestXyzBlockWidgetInstagram',
'theme_id' => 2,
'title' => 'Instagram',
'store_ids' => '0',
'widget_parameters' => '"title":"Instagram ","numberimage":"16","resolution":"standard_resolution"',
'sort_order' => 0,
'page_groups' => [[
'page_group' => 'pages',
'all_pages' => [
'page_id' => null,
//'group' => 'all_pages',
'layout_handle' => 'cms_index_index',
'block' => 'page.bottom',
'for' => 'all',
'template' => ''
]
]]
];
$this->widgetFactory->create()->setData($instaFeedWidget)->save();
But I am facing error TestXyzSetupInstaller does not exist
Any ideas will be welcomed.
magento2 widget installdata
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I need to custom requirement for creating a widget via Script. but I have facing an error when try to add a widget via below script
<?php
namespace TestXyzSetup;
use MagentoFrameworkSetup;
class InstallData implements SetupInstallDataInterface
/**
* @var SetupSampleDataExecutor
*/
protected $executor;
/**
* @var Installer
*/
protected $installer;
private $widgetFactory;
public function __construct(
SetupSampleDataExecutor $executor,
Installer $installer,
MagentoWidgetModelWidgetInstanceFactory $widgetFactory
)
$this->executor = $executor;
$this->installer = $installer;
$this->widgetFactory = $widgetFactory;
public function install(SetupModuleDataSetupInterface $setup, SetupModuleContextInterface $moduleContext)
$this->executor->exec($this->installer);
$instaFeedWidget = [
'instance_type' => 'TestXyzBlockWidgetInstagram',
'theme_id' => 2,
'title' => 'Instagram',
'store_ids' => '0',
'widget_parameters' => '"title":"Instagram ","numberimage":"16","resolution":"standard_resolution"',
'sort_order' => 0,
'page_groups' => [[
'page_group' => 'pages',
'all_pages' => [
'page_id' => null,
//'group' => 'all_pages',
'layout_handle' => 'cms_index_index',
'block' => 'page.bottom',
'for' => 'all',
'template' => ''
]
]]
];
$this->widgetFactory->create()->setData($instaFeedWidget)->save();
But I am facing error TestXyzSetupInstaller does not exist
Any ideas will be welcomed.
magento2 widget installdata
I need to custom requirement for creating a widget via Script. but I have facing an error when try to add a widget via below script
<?php
namespace TestXyzSetup;
use MagentoFrameworkSetup;
class InstallData implements SetupInstallDataInterface
/**
* @var SetupSampleDataExecutor
*/
protected $executor;
/**
* @var Installer
*/
protected $installer;
private $widgetFactory;
public function __construct(
SetupSampleDataExecutor $executor,
Installer $installer,
MagentoWidgetModelWidgetInstanceFactory $widgetFactory
)
$this->executor = $executor;
$this->installer = $installer;
$this->widgetFactory = $widgetFactory;
public function install(SetupModuleDataSetupInterface $setup, SetupModuleContextInterface $moduleContext)
$this->executor->exec($this->installer);
$instaFeedWidget = [
'instance_type' => 'TestXyzBlockWidgetInstagram',
'theme_id' => 2,
'title' => 'Instagram',
'store_ids' => '0',
'widget_parameters' => '"title":"Instagram ","numberimage":"16","resolution":"standard_resolution"',
'sort_order' => 0,
'page_groups' => [[
'page_group' => 'pages',
'all_pages' => [
'page_id' => null,
//'group' => 'all_pages',
'layout_handle' => 'cms_index_index',
'block' => 'page.bottom',
'for' => 'all',
'template' => ''
]
]]
];
$this->widgetFactory->create()->setData($instaFeedWidget)->save();
But I am facing error TestXyzSetupInstaller does not exist
Any ideas will be welcomed.
magento2 widget installdata
asked Aug 23 at 11:38
Yogesh
866822
866822
add a comment |Â
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
2
down vote
accepted
Try with this:
<?php
namespace TestXyzSetup;
use MagentoFrameworkSetup;
class InstallData implements SetupInstallDataInterface
/**
* @var SetupSampleDataExecutor
*/
protected $executor;
private $widgetFactory;
public function __construct(
SetupSampleDataExecutor $executor,
MagentoWidgetModelWidgetInstanceFactory $widgetFactory
)
$this->executor = $executor;
$this->widgetFactory = $widgetFactory;
public function install(SetupModuleDataSetupInterface $setup, SetupModuleContextInterface $moduleContext)
$instaFeedWidget = [
'instance_type' => 'TestXyzBlockWidgetInstagram',
'theme_id' => 2,
'title' => 'Instagram',
'store_ids' => '0',
'widget_parameters' => '"title":"Instagram ","numberimage":"16","resolution":"standard_resolution"',
'sort_order' => 0,
'page_groups' => [[
'page_group' => 'pages',
'all_pages' => [
'page_id' => null,
//'group' => 'all_pages',
'layout_handle' => 'cms_index_index',
'block' => 'page.bottom',
'for' => 'all',
'template' => ''
]
]]
];
$this->widgetFactory->create()->setData($instaFeedWidget)->save();
I have removed Installer $installer,
and $this->installer = $installer;
also variable
/**
* @var Installer
*/
protected $installer;
Okay let me check
â Yogesh
Aug 23 at 11:56
One supplementary question, Layout settings are not able saved, Have you any idea ?
â Yogesh
Aug 23 at 12:24
add a comment |Â
up vote
1
down vote
The reason to the error is Installer
argument in construct function. It needs to be connected with some class like how $widgetFactory
is done. After that clear code from generated/code
and run.
Let me chek that
â Yogesh
Aug 23 at 11:56
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
Try with this:
<?php
namespace TestXyzSetup;
use MagentoFrameworkSetup;
class InstallData implements SetupInstallDataInterface
/**
* @var SetupSampleDataExecutor
*/
protected $executor;
private $widgetFactory;
public function __construct(
SetupSampleDataExecutor $executor,
MagentoWidgetModelWidgetInstanceFactory $widgetFactory
)
$this->executor = $executor;
$this->widgetFactory = $widgetFactory;
public function install(SetupModuleDataSetupInterface $setup, SetupModuleContextInterface $moduleContext)
$instaFeedWidget = [
'instance_type' => 'TestXyzBlockWidgetInstagram',
'theme_id' => 2,
'title' => 'Instagram',
'store_ids' => '0',
'widget_parameters' => '"title":"Instagram ","numberimage":"16","resolution":"standard_resolution"',
'sort_order' => 0,
'page_groups' => [[
'page_group' => 'pages',
'all_pages' => [
'page_id' => null,
//'group' => 'all_pages',
'layout_handle' => 'cms_index_index',
'block' => 'page.bottom',
'for' => 'all',
'template' => ''
]
]]
];
$this->widgetFactory->create()->setData($instaFeedWidget)->save();
I have removed Installer $installer,
and $this->installer = $installer;
also variable
/**
* @var Installer
*/
protected $installer;
Okay let me check
â Yogesh
Aug 23 at 11:56
One supplementary question, Layout settings are not able saved, Have you any idea ?
â Yogesh
Aug 23 at 12:24
add a comment |Â
up vote
2
down vote
accepted
Try with this:
<?php
namespace TestXyzSetup;
use MagentoFrameworkSetup;
class InstallData implements SetupInstallDataInterface
/**
* @var SetupSampleDataExecutor
*/
protected $executor;
private $widgetFactory;
public function __construct(
SetupSampleDataExecutor $executor,
MagentoWidgetModelWidgetInstanceFactory $widgetFactory
)
$this->executor = $executor;
$this->widgetFactory = $widgetFactory;
public function install(SetupModuleDataSetupInterface $setup, SetupModuleContextInterface $moduleContext)
$instaFeedWidget = [
'instance_type' => 'TestXyzBlockWidgetInstagram',
'theme_id' => 2,
'title' => 'Instagram',
'store_ids' => '0',
'widget_parameters' => '"title":"Instagram ","numberimage":"16","resolution":"standard_resolution"',
'sort_order' => 0,
'page_groups' => [[
'page_group' => 'pages',
'all_pages' => [
'page_id' => null,
//'group' => 'all_pages',
'layout_handle' => 'cms_index_index',
'block' => 'page.bottom',
'for' => 'all',
'template' => ''
]
]]
];
$this->widgetFactory->create()->setData($instaFeedWidget)->save();
I have removed Installer $installer,
and $this->installer = $installer;
also variable
/**
* @var Installer
*/
protected $installer;
Okay let me check
â Yogesh
Aug 23 at 11:56
One supplementary question, Layout settings are not able saved, Have you any idea ?
â Yogesh
Aug 23 at 12:24
add a comment |Â
up vote
2
down vote
accepted
up vote
2
down vote
accepted
Try with this:
<?php
namespace TestXyzSetup;
use MagentoFrameworkSetup;
class InstallData implements SetupInstallDataInterface
/**
* @var SetupSampleDataExecutor
*/
protected $executor;
private $widgetFactory;
public function __construct(
SetupSampleDataExecutor $executor,
MagentoWidgetModelWidgetInstanceFactory $widgetFactory
)
$this->executor = $executor;
$this->widgetFactory = $widgetFactory;
public function install(SetupModuleDataSetupInterface $setup, SetupModuleContextInterface $moduleContext)
$instaFeedWidget = [
'instance_type' => 'TestXyzBlockWidgetInstagram',
'theme_id' => 2,
'title' => 'Instagram',
'store_ids' => '0',
'widget_parameters' => '"title":"Instagram ","numberimage":"16","resolution":"standard_resolution"',
'sort_order' => 0,
'page_groups' => [[
'page_group' => 'pages',
'all_pages' => [
'page_id' => null,
//'group' => 'all_pages',
'layout_handle' => 'cms_index_index',
'block' => 'page.bottom',
'for' => 'all',
'template' => ''
]
]]
];
$this->widgetFactory->create()->setData($instaFeedWidget)->save();
I have removed Installer $installer,
and $this->installer = $installer;
also variable
/**
* @var Installer
*/
protected $installer;
Try with this:
<?php
namespace TestXyzSetup;
use MagentoFrameworkSetup;
class InstallData implements SetupInstallDataInterface
/**
* @var SetupSampleDataExecutor
*/
protected $executor;
private $widgetFactory;
public function __construct(
SetupSampleDataExecutor $executor,
MagentoWidgetModelWidgetInstanceFactory $widgetFactory
)
$this->executor = $executor;
$this->widgetFactory = $widgetFactory;
public function install(SetupModuleDataSetupInterface $setup, SetupModuleContextInterface $moduleContext)
$instaFeedWidget = [
'instance_type' => 'TestXyzBlockWidgetInstagram',
'theme_id' => 2,
'title' => 'Instagram',
'store_ids' => '0',
'widget_parameters' => '"title":"Instagram ","numberimage":"16","resolution":"standard_resolution"',
'sort_order' => 0,
'page_groups' => [[
'page_group' => 'pages',
'all_pages' => [
'page_id' => null,
//'group' => 'all_pages',
'layout_handle' => 'cms_index_index',
'block' => 'page.bottom',
'for' => 'all',
'template' => ''
]
]]
];
$this->widgetFactory->create()->setData($instaFeedWidget)->save();
I have removed Installer $installer,
and $this->installer = $installer;
also variable
/**
* @var Installer
*/
protected $installer;
answered Aug 23 at 11:49
kunj
2,3772420
2,3772420
Okay let me check
â Yogesh
Aug 23 at 11:56
One supplementary question, Layout settings are not able saved, Have you any idea ?
â Yogesh
Aug 23 at 12:24
add a comment |Â
Okay let me check
â Yogesh
Aug 23 at 11:56
One supplementary question, Layout settings are not able saved, Have you any idea ?
â Yogesh
Aug 23 at 12:24
Okay let me check
â Yogesh
Aug 23 at 11:56
Okay let me check
â Yogesh
Aug 23 at 11:56
One supplementary question, Layout settings are not able saved, Have you any idea ?
â Yogesh
Aug 23 at 12:24
One supplementary question, Layout settings are not able saved, Have you any idea ?
â Yogesh
Aug 23 at 12:24
add a comment |Â
up vote
1
down vote
The reason to the error is Installer
argument in construct function. It needs to be connected with some class like how $widgetFactory
is done. After that clear code from generated/code
and run.
Let me chek that
â Yogesh
Aug 23 at 11:56
add a comment |Â
up vote
1
down vote
The reason to the error is Installer
argument in construct function. It needs to be connected with some class like how $widgetFactory
is done. After that clear code from generated/code
and run.
Let me chek that
â Yogesh
Aug 23 at 11:56
add a comment |Â
up vote
1
down vote
up vote
1
down vote
The reason to the error is Installer
argument in construct function. It needs to be connected with some class like how $widgetFactory
is done. After that clear code from generated/code
and run.
The reason to the error is Installer
argument in construct function. It needs to be connected with some class like how $widgetFactory
is done. After that clear code from generated/code
and run.
answered Aug 23 at 11:49
LAW
623516
623516
Let me chek that
â Yogesh
Aug 23 at 11:56
add a comment |Â
Let me chek that
â Yogesh
Aug 23 at 11:56
Let me chek that
â Yogesh
Aug 23 at 11:56
Let me chek that
â Yogesh
Aug 23 at 11:56
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f239348%2fmagento-2-create-widget-via-installdata-script%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password