Magento 2 : Invalid block type while creating custom grid in backend The 2019 Stack Overflow Developer Survey Results Are InSetup version for module 'Sample_CustomController' is not specifiedI created a custom module ,but getting error, not able to figure out what the error is about. How to get out of this error?Not able to add/update magento2 category post upgrade from 1.9 to 2.1.0Trying to uninstall moduleHow to solve Front controller reached 100 router match iterations in magento2Magento 2 Front controller reached 100 router match iterations issueDeleted ShipperHQ module causing error in “All Customers” section of Magento 2“Area code is not set” in var/logwhen click on place order then paypal showing error in Magento2magento error logs Error log record number: 1173359093956
Likelihood that a superbug or lethal virus could come from a landfill
Can we generate random numbers using irrational numbers like π and e?
What do hard-Brexiteers want with respect to the Irish border?
Is it okay to consider publishing in my first year of PhD?
Ubuntu Server install with full GUI
What does もの mean in this sentence?
Is it ethical to upload a automatically generated paper to a non peer-reviewed site as part of a larger research?
What do these terms in Caesar's Gallic Wars mean?
Inverse Relationship Between Precision and Recall
Deal with toxic manager when you can't quit
How to notate time signature switching consistently every measure
What to do when moving next to a bird sanctuary with a loosely-domesticated cat?
Is it ok to offer lower paid work as a trial period before negotiating for a full-time job?
What information about me do stores get via my credit card?
Does adding complexity mean a more secure cipher?
Button changing its text & action. Good or terrible?
Accepted by European university, rejected by all American ones I applied to? Possible reasons?
How much of the clove should I use when using big garlic heads?
How can I define good in a religion that claims no moral authority?
Why isn't the circumferential light around the M87 black hole's event horizon symmetric?
What is this sharp, curved notch on my knife for?
APIPA and LAN Broadcast Domain
How do PCB vias affect signal quality?
A word that means fill it to the required quantity
Magento 2 : Invalid block type while creating custom grid in backend
The 2019 Stack Overflow Developer Survey Results Are InSetup version for module 'Sample_CustomController' is not specifiedI created a custom module ,but getting error, not able to figure out what the error is about. How to get out of this error?Not able to add/update magento2 category post upgrade from 1.9 to 2.1.0Trying to uninstall moduleHow to solve Front controller reached 100 router match iterations in magento2Magento 2 Front controller reached 100 router match iterations issueDeleted ShipperHQ module causing error in “All Customers” section of Magento 2“Area code is not set” in var/logwhen click on place order then paypal showing error in Magento2magento error logs Error log record number: 1173359093956
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I've been trying to create custom gird in magento 2.0.11 but it keep returning Invalid block type:
This error occurs while executing the file Tomrain/Appcustomizer/Block/Adminhtml/Clipartcategories.php
in following code :
$this->setChild(
'grid',
$this->getLayout()->createBlock('TomrainAppcustomizerBlockAdminhtmlClipartcategoriesGrid', 'appcustomizer.grid')
);
But I have block TomrainAppcustomizerBlockAdminhtmlClipartcategoriesGrid
Invalid block type: TomrainAppcustomizerBlockAdminhtmlClipartcategoriesGrid
#0 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Layout/Generator/Block.php(237): MagentoFrameworkViewLayoutGeneratorBlock->getBlockInstance('Tomrain\Appcust...', Array)
#1 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Layout.php(760): MagentoFrameworkViewLayoutGeneratorBlock->createBlock('Tomrain\Appcust...', 'appcustomizer.g...', Array)
#2 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Layout.php(743): MagentoFrameworkViewLayout->_createBlock('Tomrain\Appcust...', 'appcustomizer.g...', Array)
#3 /var/www/html/appcustomizer-tshirt-M2/var/generation/Magento/Framework/View/Layout/Interceptor.php(349): MagentoFrameworkViewLayout->createBlock('Tomrain\Appcust...', 'appcustomizer.g...', Array)
#4 /var/www/html/appcustomizer-tshirt-M2/app/code/Tomrain/Appcustomizer/Block/Adminhtml/Clipartcategories.php(41): MagentoFrameworkViewLayoutInterceptor->createBlock('Tomrain\Appcust...', 'appcustomizer.g...')
#5 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Element/AbstractBlock.php(262): TomrainAppcustomizerBlockAdminhtmlClipartcategories->_prepareLayout()
#6 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Layout/Generator/Block.php(139): MagentoFrameworkViewElementAbstractBlock->setLayout(Object(MagentoFrameworkViewLayoutInterceptor))
#7 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Layout/GeneratorPool.php(86): MagentoFrameworkViewLayoutGeneratorBlock->process(Object(MagentoFrameworkViewLayoutReaderContext), Object(MagentoFrameworkViewLayoutGeneratorContext))
#8 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Layout.php(327): MagentoFrameworkViewLayoutGeneratorPool->process(Object(MagentoFrameworkViewLayoutReaderContext), Object(MagentoFrameworkViewLayoutGeneratorContext))
#9 /var/www/html/appcustomizer-tshirt-M2/var/generation/Magento/Framework/View/Layout/Interceptor.php(89): MagentoFrameworkViewLayout->generateElements()
#10 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Layout/Builder.php(129): MagentoFrameworkViewLayoutInterceptor->generateElements()
#11 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Page/Builder.php(55): MagentoFrameworkViewLayoutBuilder->generateLayoutBlocks()
#12 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Layout/Builder.php(65): MagentoFrameworkViewPageBuilder->generateLayoutBlocks()
#13 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Layout.php(244): MagentoFrameworkViewLayoutBuilder->build()
#14 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Layout.php(859): MagentoFrameworkViewLayout->build()
#15 /var/www/html/appcustomizer-tshirt-M2/var/generation/Magento/Framework/View/Layout/Interceptor.php(414): MagentoFrameworkViewLayout->getBlock('menu')
#16 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/module-backend/Model/View/Result/Page.php(59): MagentoFrameworkViewLayoutInterceptor->getBlock('menu')
#17 /var/www/html/appcustomizer-tshirt-M2/var/generation/Magento/Backend/Model/View/Result/Page/Interceptor.php(24): MagentoBackendModelViewResultPage->setActiveMenu('Tomrain_Appcust...')
#18 /var/www/html/appcustomizer-tshirt-M2/app/code/Tomrain/Appcustomizer/Controller/Adminhtml/Clipartcategories/Index.php(36): MagentoBackendModelViewResultPageInterceptor->setActiveMenu('Tomrain_Appcust...')
#19 /var/www/html/appcustomizer-tshirt-M2/var/generation/Tomrain/Appcustomizer/Controller/Adminhtml/Clipartcategories/Index/Interceptor.php(25): TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndex->execute()
#20 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/App/Action/Action.php(102): TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor->execute()
#21 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/module-backend/App/AbstractAction.php(226): MagentoFrameworkAppActionAction->dispatch(Object(MagentoFrameworkAppRequestHttp))
#22 [internal function]: MagentoBackendAppAbstractAction->dispatch(Object(MagentoFrameworkAppRequestHttp))
#23 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Interceptor.php(74): call_user_func_array(Array, Array)
#24 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Chain/Chain.php(70): TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor->___callParent('dispatch', Array)
#25 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Chain/Chain.php(63): MagentoFrameworkInterceptionChainChain->invokeNext('Tomrain\Appcust...', 'dispatch', Object(TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor), Array, 'adminAuthentica...')
#26 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/module-backend/App/Action/Plugin/Authentication.php(143): MagentoFrameworkInterceptionChainChain->MagentoFrameworkInterceptionChainclosure(Object(MagentoFrameworkAppRequestHttp))
#27 [internal function]: MagentoBackendAppActionPluginAuthentication->aroundDispatch(Object(TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor), Object(Closure), Object(MagentoFrameworkAppRequestHttp))
#28 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Chain/Chain.php(67): call_user_func_array(Array, Array)
#29 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Chain/Chain.php(63): MagentoFrameworkInterceptionChainChain->invokeNext('Tomrain\Appcust...', 'dispatch', Object(TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor), Array, 'designLoader')
#30 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/App/Action/Plugin/Design.php(39): MagentoFrameworkInterceptionChainChain->MagentoFrameworkInterceptionChainclosure(Object(MagentoFrameworkAppRequestHttp))
#31 [internal function]: MagentoFrameworkAppActionPluginDesign->aroundDispatch(Object(TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor), Object(Closure), Object(MagentoFrameworkAppRequestHttp))
#32 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Chain/Chain.php(67): call_user_func_array(Array, Array)
#33 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Interceptor.php(138): MagentoFrameworkInterceptionChainChain->invokeNext('Tomrain\Appcust...', 'dispatch', Object(TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor), Array, 'adminMassaction...')
#34 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/module-backend/App/Action/Plugin/MassactionKey.php(33): TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor->MagentoFrameworkInterceptionclosure(Object(MagentoFrameworkAppRequestHttp))
#35 [internal function]: MagentoBackendAppActionPluginMassactionKey->aroundDispatch(Object(TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor), Object(Closure), Object(MagentoFrameworkAppRequestHttp))
#36 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Interceptor.php(142): call_user_func_array(Array, Array)
#37 /var/www/html/appcustomizer-tshirt-M2/var/generation/Tomrain/Appcustomizer/Controller/Adminhtml/Clipartcategories/Index/Interceptor.php(40): TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor->___callPlugins('dispatch', Array, Array)
#38 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/App/FrontController.php(55): TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor->dispatch(Object(MagentoFrameworkAppRequestHttp))
#39 [internal function]: MagentoFrameworkAppFrontController->dispatch(Object(MagentoFrameworkAppRequestHttp))
#40 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Interceptor.php(74): call_user_func_array(Array, Array)
#41 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Chain/Chain.php(70): MagentoFrameworkAppFrontControllerInterceptor->___callParent('dispatch', Array)
#42 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Interceptor.php(138): MagentoFrameworkInterceptionChainChain->invokeNext('Magento\Framewo...', 'dispatch', Object(MagentoFrameworkAppFrontControllerInterceptor), Array, 'install')
#43 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Module/Plugin/DbStatusValidator.php(69): MagentoFrameworkAppFrontControllerInterceptor->MagentoFrameworkInterceptionclosure(Object(MagentoFrameworkAppRequestHttp))
#44 [internal function]: MagentoFrameworkModulePluginDbStatusValidator->aroundDispatch(Object(MagentoFrameworkAppFrontControllerInterceptor), Object(Closure), Object(MagentoFrameworkAppRequestHttp))
#45 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Interceptor.php(142): call_user_func_array(Array, Array)
#46 /var/www/html/appcustomizer-tshirt-M2/var/generation/Magento/Framework/App/FrontController/Interceptor.php(26): MagentoFrameworkAppFrontControllerInterceptor->___callPlugins('dispatch', Array, Array)
#47 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/App/Http.php(115): MagentoFrameworkAppFrontControllerInterceptor->dispatch(Object(MagentoFrameworkAppRequestHttp))
#48 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/App/Bootstrap.php(258): MagentoFrameworkAppHttp->launch()
#49 /var/www/html/appcustomizer-tshirt-M2/index.php(42): MagentoFrameworkAppBootstrap->run(Object(MagentoFrameworkAppHttp))
Tomrain/Appcustomizer/Block/Adminhtml/Clipartcategories.php
namespace TomrainAppcustomizerBlockAdminhtml;
class Clipartcategories extends MagentoBackendBlockWidgetContainer
/**
* @var string
*/
protected $_template = 'clipartcategories/entries.phtml';
/**
* @param MagentoBackendBlockWidgetContext $context
* @param array $data
*/
public function __construct(
MagentoBackendBlockWidgetContext $context,
array $data = []
)
parent::__construct($context, $data);
/**
* Prepare button and grid
*
* @return MagentoCatalogBlockAdminhtmlProduct
*/
protected function _prepareLayout()
$addButtonProps = [
'id' => 'add_new_entry_post',
'label' => __('Add New'),
'class' => 'add',
'button_class' => '',
'class_name' => 'MagentoBackendBlockWidgetButtonSplitButton',
'options' => $this->_getAddButtonOptions(),
];
$this->buttonList->add('add_new', $addButtonProps);
$this->setChild(
'grid',
$this->getLayout()->createBlock('TomrainAppcustomizerBlockAdminhtmlClipartcategoriesGrid', 'appcustomizer.grid')
);
return parent::_prepareLayout();
/**
*
*
* @return array
*/
protected function _getAddButtonOptions()
$splitButtonOptions[] = [
'label' => __('Add New'),
'onclick' => "setLocation('" . $this->_getCreateUrl() . "')"
];
return $splitButtonOptions;
/**
*
*
* @param string $type
* @return string
*/
protected function _getCreateUrl()
return $this->getUrl(
'appcustomizer/*/new'
);
/**
* Render grid
*
* @return string
*/
public function getGridHtml()
return $this->getChildHtml('grid');
Tomrain/Appcustomizer/Block/Adminhtml/Clipartcategories/Grid.php
namespace TomrainAppcustomizerBlockAdminhtmlClipartcategories;
class Grid extends MagentoBackendBlockWidgetGridExtended
/**
* @var MagentoFrameworkModuleManager
*/
protected $moduleManager;
/**
* @var TomrainAppcustomizerModelClipartcategoriesFactory
*/
protected $_clipartcategoriesFactory;
protected $_status;
/**
* @param MagentoBackendBlockTemplateContext $context
* @param MagentoBackendHelperData $backendHelper
* @param TomrainAppcustomizerModelClipartcategoriesFactory $clipartcategoriesFactory
* @param TomrainAppcustomizerModelStatus $status
* @param MagentoFrameworkModuleManager $moduleManager
* @param array $data
*
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
public function __construct(
MagentoBackendBlockTemplateContext $context,
MagentoBackendHelperData $backendHelper,
TomrainAppcustomizerModelClipartcategoriesFactory $clipartcategoriesFactory,
TomrainAppcustomizerModelStatus $status,
MagentoFrameworkModuleManager $moduleManager,
array $data = []
)
$this->_clipartcategoriesFactory = $clipartcategoriesFactory;
$this->_status = $status;
$this->moduleManager = $moduleManager;
parent::__construct($context, $backendHelper, $data);
/**
* @return void
*/
protected function _construct()
parent::_construct();
$this->setId('postGrid');
$this->setDefaultSort('id');
$this->setDefaultDir('DESC');
$this->setSaveParametersInSession(true);
$this->setUseAjax(true);
$this->setVarNameFilter('post_filter');
/**
* @return $this
*/
protected function _prepareCollection()
$collection = $this->_clipartcategoriesFactory->create()->getCollection();
$this->setCollection($collection);
parent::_prepareCollection();
return $this;
/**
* @return $this
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
protected function _prepareColumns()
$this->addColumn(
'id',
[
'header' => __('ID'),
'type' => 'number',
'index' => 'id',
'header_css_class' => 'col-id',
'column_css_class' => 'col-id',
'name'=>'id'
]
);
$this->addColumn(
'label',
[
'header' => __('Category'),
'index' => 'label',
'class' => 'xxx',
'name'=>'label'
]
);
$this->addColumn(
'parent_id',
[
'header' => __('Parent Category'),
'index' => 'parent_id',
'class' => 'xxx',
'name'=>'parent_id',
'options' => $this->_status->_getAttributeOptions()
]
);
$this->addColumn(
'image',
array(
'header' => __('Image'),
'index' => 'image',
'renderer' => 'TomrainAppcustomizerBlockAdminhtmlInquiryGridRendererClipartcategories',
)
);
$this->addColumn(
'status',
[
'header' => __('Active'),
'index' => 'status',
'type' => 'options',
'name'=>'status',
'options' => $this->_status->getOptionArray()
]
);
$this->addColumn(
'edit',
[
'header' => __('Edit'),
'type' => 'action',
'getter' => 'getId',
'actions' => [
[
'caption' => __('Edit'),
'url' => [
'base' => '*/*/edit'
],
'field' => 'id'
]
],
'filter' => false,
'sortable' => false,
'index' => 'stores',
'header_css_class' => 'col-action',
'column_css_class' => 'col-action'
]
);
$block = $this->getLayout()->getBlock('grid.bottom.links');
if ($block)
$this->setChild('grid.bottom.links', $block);
return parent::_prepareColumns();
/**
* @return $this
*/
protected function _prepareMassaction()
$this->setMassactionIdField('id');
$this->getMassactionBlock()->setTemplate('Tomrain_Appcustomizer::clipartcategories/grid/massaction_extended.phtml');
$this->getMassactionBlock()->setFormFieldName('label');
$this->getMassactionBlock()->addItem(
'delete',
[
'label' => __('Delete'),
'url' => $this->getUrl('appcustomizer/*/massDelete'),
'confirm' => __('Are you sure?')
]
);
$statuses = $this->_status->getOptionArray();
array_unshift($statuses, ['label' => '', 'value' => '']);
$this->getMassactionBlock()->addItem(
'status',
[
'label' => __('Change status'),
'url' => $this->getUrl('appcustomizer/*/massStatus', ['_current' => true]),
'additional' => [
'visibility' => [
'name' => 'status',
'type' => 'select',
'class' => 'required-entry',
'label' => __('Status'),
'values' => $statuses
]
]
]
);
return $this;
/**
* @return string
*/
public function getGridUrl()
return $this->getUrl('appcustomizer/*/grid', ['_current' => true]);
public function getRowUrl($row)
return $this->getUrl(
'appcustomizer/*/edit',
['id' => $row->getId()]
);
magento2 module admin custom-grid
add a comment |
I've been trying to create custom gird in magento 2.0.11 but it keep returning Invalid block type:
This error occurs while executing the file Tomrain/Appcustomizer/Block/Adminhtml/Clipartcategories.php
in following code :
$this->setChild(
'grid',
$this->getLayout()->createBlock('TomrainAppcustomizerBlockAdminhtmlClipartcategoriesGrid', 'appcustomizer.grid')
);
But I have block TomrainAppcustomizerBlockAdminhtmlClipartcategoriesGrid
Invalid block type: TomrainAppcustomizerBlockAdminhtmlClipartcategoriesGrid
#0 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Layout/Generator/Block.php(237): MagentoFrameworkViewLayoutGeneratorBlock->getBlockInstance('Tomrain\Appcust...', Array)
#1 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Layout.php(760): MagentoFrameworkViewLayoutGeneratorBlock->createBlock('Tomrain\Appcust...', 'appcustomizer.g...', Array)
#2 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Layout.php(743): MagentoFrameworkViewLayout->_createBlock('Tomrain\Appcust...', 'appcustomizer.g...', Array)
#3 /var/www/html/appcustomizer-tshirt-M2/var/generation/Magento/Framework/View/Layout/Interceptor.php(349): MagentoFrameworkViewLayout->createBlock('Tomrain\Appcust...', 'appcustomizer.g...', Array)
#4 /var/www/html/appcustomizer-tshirt-M2/app/code/Tomrain/Appcustomizer/Block/Adminhtml/Clipartcategories.php(41): MagentoFrameworkViewLayoutInterceptor->createBlock('Tomrain\Appcust...', 'appcustomizer.g...')
#5 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Element/AbstractBlock.php(262): TomrainAppcustomizerBlockAdminhtmlClipartcategories->_prepareLayout()
#6 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Layout/Generator/Block.php(139): MagentoFrameworkViewElementAbstractBlock->setLayout(Object(MagentoFrameworkViewLayoutInterceptor))
#7 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Layout/GeneratorPool.php(86): MagentoFrameworkViewLayoutGeneratorBlock->process(Object(MagentoFrameworkViewLayoutReaderContext), Object(MagentoFrameworkViewLayoutGeneratorContext))
#8 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Layout.php(327): MagentoFrameworkViewLayoutGeneratorPool->process(Object(MagentoFrameworkViewLayoutReaderContext), Object(MagentoFrameworkViewLayoutGeneratorContext))
#9 /var/www/html/appcustomizer-tshirt-M2/var/generation/Magento/Framework/View/Layout/Interceptor.php(89): MagentoFrameworkViewLayout->generateElements()
#10 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Layout/Builder.php(129): MagentoFrameworkViewLayoutInterceptor->generateElements()
#11 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Page/Builder.php(55): MagentoFrameworkViewLayoutBuilder->generateLayoutBlocks()
#12 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Layout/Builder.php(65): MagentoFrameworkViewPageBuilder->generateLayoutBlocks()
#13 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Layout.php(244): MagentoFrameworkViewLayoutBuilder->build()
#14 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Layout.php(859): MagentoFrameworkViewLayout->build()
#15 /var/www/html/appcustomizer-tshirt-M2/var/generation/Magento/Framework/View/Layout/Interceptor.php(414): MagentoFrameworkViewLayout->getBlock('menu')
#16 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/module-backend/Model/View/Result/Page.php(59): MagentoFrameworkViewLayoutInterceptor->getBlock('menu')
#17 /var/www/html/appcustomizer-tshirt-M2/var/generation/Magento/Backend/Model/View/Result/Page/Interceptor.php(24): MagentoBackendModelViewResultPage->setActiveMenu('Tomrain_Appcust...')
#18 /var/www/html/appcustomizer-tshirt-M2/app/code/Tomrain/Appcustomizer/Controller/Adminhtml/Clipartcategories/Index.php(36): MagentoBackendModelViewResultPageInterceptor->setActiveMenu('Tomrain_Appcust...')
#19 /var/www/html/appcustomizer-tshirt-M2/var/generation/Tomrain/Appcustomizer/Controller/Adminhtml/Clipartcategories/Index/Interceptor.php(25): TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndex->execute()
#20 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/App/Action/Action.php(102): TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor->execute()
#21 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/module-backend/App/AbstractAction.php(226): MagentoFrameworkAppActionAction->dispatch(Object(MagentoFrameworkAppRequestHttp))
#22 [internal function]: MagentoBackendAppAbstractAction->dispatch(Object(MagentoFrameworkAppRequestHttp))
#23 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Interceptor.php(74): call_user_func_array(Array, Array)
#24 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Chain/Chain.php(70): TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor->___callParent('dispatch', Array)
#25 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Chain/Chain.php(63): MagentoFrameworkInterceptionChainChain->invokeNext('Tomrain\Appcust...', 'dispatch', Object(TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor), Array, 'adminAuthentica...')
#26 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/module-backend/App/Action/Plugin/Authentication.php(143): MagentoFrameworkInterceptionChainChain->MagentoFrameworkInterceptionChainclosure(Object(MagentoFrameworkAppRequestHttp))
#27 [internal function]: MagentoBackendAppActionPluginAuthentication->aroundDispatch(Object(TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor), Object(Closure), Object(MagentoFrameworkAppRequestHttp))
#28 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Chain/Chain.php(67): call_user_func_array(Array, Array)
#29 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Chain/Chain.php(63): MagentoFrameworkInterceptionChainChain->invokeNext('Tomrain\Appcust...', 'dispatch', Object(TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor), Array, 'designLoader')
#30 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/App/Action/Plugin/Design.php(39): MagentoFrameworkInterceptionChainChain->MagentoFrameworkInterceptionChainclosure(Object(MagentoFrameworkAppRequestHttp))
#31 [internal function]: MagentoFrameworkAppActionPluginDesign->aroundDispatch(Object(TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor), Object(Closure), Object(MagentoFrameworkAppRequestHttp))
#32 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Chain/Chain.php(67): call_user_func_array(Array, Array)
#33 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Interceptor.php(138): MagentoFrameworkInterceptionChainChain->invokeNext('Tomrain\Appcust...', 'dispatch', Object(TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor), Array, 'adminMassaction...')
#34 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/module-backend/App/Action/Plugin/MassactionKey.php(33): TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor->MagentoFrameworkInterceptionclosure(Object(MagentoFrameworkAppRequestHttp))
#35 [internal function]: MagentoBackendAppActionPluginMassactionKey->aroundDispatch(Object(TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor), Object(Closure), Object(MagentoFrameworkAppRequestHttp))
#36 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Interceptor.php(142): call_user_func_array(Array, Array)
#37 /var/www/html/appcustomizer-tshirt-M2/var/generation/Tomrain/Appcustomizer/Controller/Adminhtml/Clipartcategories/Index/Interceptor.php(40): TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor->___callPlugins('dispatch', Array, Array)
#38 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/App/FrontController.php(55): TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor->dispatch(Object(MagentoFrameworkAppRequestHttp))
#39 [internal function]: MagentoFrameworkAppFrontController->dispatch(Object(MagentoFrameworkAppRequestHttp))
#40 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Interceptor.php(74): call_user_func_array(Array, Array)
#41 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Chain/Chain.php(70): MagentoFrameworkAppFrontControllerInterceptor->___callParent('dispatch', Array)
#42 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Interceptor.php(138): MagentoFrameworkInterceptionChainChain->invokeNext('Magento\Framewo...', 'dispatch', Object(MagentoFrameworkAppFrontControllerInterceptor), Array, 'install')
#43 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Module/Plugin/DbStatusValidator.php(69): MagentoFrameworkAppFrontControllerInterceptor->MagentoFrameworkInterceptionclosure(Object(MagentoFrameworkAppRequestHttp))
#44 [internal function]: MagentoFrameworkModulePluginDbStatusValidator->aroundDispatch(Object(MagentoFrameworkAppFrontControllerInterceptor), Object(Closure), Object(MagentoFrameworkAppRequestHttp))
#45 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Interceptor.php(142): call_user_func_array(Array, Array)
#46 /var/www/html/appcustomizer-tshirt-M2/var/generation/Magento/Framework/App/FrontController/Interceptor.php(26): MagentoFrameworkAppFrontControllerInterceptor->___callPlugins('dispatch', Array, Array)
#47 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/App/Http.php(115): MagentoFrameworkAppFrontControllerInterceptor->dispatch(Object(MagentoFrameworkAppRequestHttp))
#48 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/App/Bootstrap.php(258): MagentoFrameworkAppHttp->launch()
#49 /var/www/html/appcustomizer-tshirt-M2/index.php(42): MagentoFrameworkAppBootstrap->run(Object(MagentoFrameworkAppHttp))
Tomrain/Appcustomizer/Block/Adminhtml/Clipartcategories.php
namespace TomrainAppcustomizerBlockAdminhtml;
class Clipartcategories extends MagentoBackendBlockWidgetContainer
/**
* @var string
*/
protected $_template = 'clipartcategories/entries.phtml';
/**
* @param MagentoBackendBlockWidgetContext $context
* @param array $data
*/
public function __construct(
MagentoBackendBlockWidgetContext $context,
array $data = []
)
parent::__construct($context, $data);
/**
* Prepare button and grid
*
* @return MagentoCatalogBlockAdminhtmlProduct
*/
protected function _prepareLayout()
$addButtonProps = [
'id' => 'add_new_entry_post',
'label' => __('Add New'),
'class' => 'add',
'button_class' => '',
'class_name' => 'MagentoBackendBlockWidgetButtonSplitButton',
'options' => $this->_getAddButtonOptions(),
];
$this->buttonList->add('add_new', $addButtonProps);
$this->setChild(
'grid',
$this->getLayout()->createBlock('TomrainAppcustomizerBlockAdminhtmlClipartcategoriesGrid', 'appcustomizer.grid')
);
return parent::_prepareLayout();
/**
*
*
* @return array
*/
protected function _getAddButtonOptions()
$splitButtonOptions[] = [
'label' => __('Add New'),
'onclick' => "setLocation('" . $this->_getCreateUrl() . "')"
];
return $splitButtonOptions;
/**
*
*
* @param string $type
* @return string
*/
protected function _getCreateUrl()
return $this->getUrl(
'appcustomizer/*/new'
);
/**
* Render grid
*
* @return string
*/
public function getGridHtml()
return $this->getChildHtml('grid');
Tomrain/Appcustomizer/Block/Adminhtml/Clipartcategories/Grid.php
namespace TomrainAppcustomizerBlockAdminhtmlClipartcategories;
class Grid extends MagentoBackendBlockWidgetGridExtended
/**
* @var MagentoFrameworkModuleManager
*/
protected $moduleManager;
/**
* @var TomrainAppcustomizerModelClipartcategoriesFactory
*/
protected $_clipartcategoriesFactory;
protected $_status;
/**
* @param MagentoBackendBlockTemplateContext $context
* @param MagentoBackendHelperData $backendHelper
* @param TomrainAppcustomizerModelClipartcategoriesFactory $clipartcategoriesFactory
* @param TomrainAppcustomizerModelStatus $status
* @param MagentoFrameworkModuleManager $moduleManager
* @param array $data
*
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
public function __construct(
MagentoBackendBlockTemplateContext $context,
MagentoBackendHelperData $backendHelper,
TomrainAppcustomizerModelClipartcategoriesFactory $clipartcategoriesFactory,
TomrainAppcustomizerModelStatus $status,
MagentoFrameworkModuleManager $moduleManager,
array $data = []
)
$this->_clipartcategoriesFactory = $clipartcategoriesFactory;
$this->_status = $status;
$this->moduleManager = $moduleManager;
parent::__construct($context, $backendHelper, $data);
/**
* @return void
*/
protected function _construct()
parent::_construct();
$this->setId('postGrid');
$this->setDefaultSort('id');
$this->setDefaultDir('DESC');
$this->setSaveParametersInSession(true);
$this->setUseAjax(true);
$this->setVarNameFilter('post_filter');
/**
* @return $this
*/
protected function _prepareCollection()
$collection = $this->_clipartcategoriesFactory->create()->getCollection();
$this->setCollection($collection);
parent::_prepareCollection();
return $this;
/**
* @return $this
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
protected function _prepareColumns()
$this->addColumn(
'id',
[
'header' => __('ID'),
'type' => 'number',
'index' => 'id',
'header_css_class' => 'col-id',
'column_css_class' => 'col-id',
'name'=>'id'
]
);
$this->addColumn(
'label',
[
'header' => __('Category'),
'index' => 'label',
'class' => 'xxx',
'name'=>'label'
]
);
$this->addColumn(
'parent_id',
[
'header' => __('Parent Category'),
'index' => 'parent_id',
'class' => 'xxx',
'name'=>'parent_id',
'options' => $this->_status->_getAttributeOptions()
]
);
$this->addColumn(
'image',
array(
'header' => __('Image'),
'index' => 'image',
'renderer' => 'TomrainAppcustomizerBlockAdminhtmlInquiryGridRendererClipartcategories',
)
);
$this->addColumn(
'status',
[
'header' => __('Active'),
'index' => 'status',
'type' => 'options',
'name'=>'status',
'options' => $this->_status->getOptionArray()
]
);
$this->addColumn(
'edit',
[
'header' => __('Edit'),
'type' => 'action',
'getter' => 'getId',
'actions' => [
[
'caption' => __('Edit'),
'url' => [
'base' => '*/*/edit'
],
'field' => 'id'
]
],
'filter' => false,
'sortable' => false,
'index' => 'stores',
'header_css_class' => 'col-action',
'column_css_class' => 'col-action'
]
);
$block = $this->getLayout()->getBlock('grid.bottom.links');
if ($block)
$this->setChild('grid.bottom.links', $block);
return parent::_prepareColumns();
/**
* @return $this
*/
protected function _prepareMassaction()
$this->setMassactionIdField('id');
$this->getMassactionBlock()->setTemplate('Tomrain_Appcustomizer::clipartcategories/grid/massaction_extended.phtml');
$this->getMassactionBlock()->setFormFieldName('label');
$this->getMassactionBlock()->addItem(
'delete',
[
'label' => __('Delete'),
'url' => $this->getUrl('appcustomizer/*/massDelete'),
'confirm' => __('Are you sure?')
]
);
$statuses = $this->_status->getOptionArray();
array_unshift($statuses, ['label' => '', 'value' => '']);
$this->getMassactionBlock()->addItem(
'status',
[
'label' => __('Change status'),
'url' => $this->getUrl('appcustomizer/*/massStatus', ['_current' => true]),
'additional' => [
'visibility' => [
'name' => 'status',
'type' => 'select',
'class' => 'required-entry',
'label' => __('Status'),
'values' => $statuses
]
]
]
);
return $this;
/**
* @return string
*/
public function getGridUrl()
return $this->getUrl('appcustomizer/*/grid', ['_current' => true]);
public function getRowUrl($row)
return $this->getUrl(
'appcustomizer/*/edit',
['id' => $row->getId()]
);
magento2 module admin custom-grid
add a comment |
I've been trying to create custom gird in magento 2.0.11 but it keep returning Invalid block type:
This error occurs while executing the file Tomrain/Appcustomizer/Block/Adminhtml/Clipartcategories.php
in following code :
$this->setChild(
'grid',
$this->getLayout()->createBlock('TomrainAppcustomizerBlockAdminhtmlClipartcategoriesGrid', 'appcustomizer.grid')
);
But I have block TomrainAppcustomizerBlockAdminhtmlClipartcategoriesGrid
Invalid block type: TomrainAppcustomizerBlockAdminhtmlClipartcategoriesGrid
#0 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Layout/Generator/Block.php(237): MagentoFrameworkViewLayoutGeneratorBlock->getBlockInstance('Tomrain\Appcust...', Array)
#1 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Layout.php(760): MagentoFrameworkViewLayoutGeneratorBlock->createBlock('Tomrain\Appcust...', 'appcustomizer.g...', Array)
#2 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Layout.php(743): MagentoFrameworkViewLayout->_createBlock('Tomrain\Appcust...', 'appcustomizer.g...', Array)
#3 /var/www/html/appcustomizer-tshirt-M2/var/generation/Magento/Framework/View/Layout/Interceptor.php(349): MagentoFrameworkViewLayout->createBlock('Tomrain\Appcust...', 'appcustomizer.g...', Array)
#4 /var/www/html/appcustomizer-tshirt-M2/app/code/Tomrain/Appcustomizer/Block/Adminhtml/Clipartcategories.php(41): MagentoFrameworkViewLayoutInterceptor->createBlock('Tomrain\Appcust...', 'appcustomizer.g...')
#5 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Element/AbstractBlock.php(262): TomrainAppcustomizerBlockAdminhtmlClipartcategories->_prepareLayout()
#6 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Layout/Generator/Block.php(139): MagentoFrameworkViewElementAbstractBlock->setLayout(Object(MagentoFrameworkViewLayoutInterceptor))
#7 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Layout/GeneratorPool.php(86): MagentoFrameworkViewLayoutGeneratorBlock->process(Object(MagentoFrameworkViewLayoutReaderContext), Object(MagentoFrameworkViewLayoutGeneratorContext))
#8 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Layout.php(327): MagentoFrameworkViewLayoutGeneratorPool->process(Object(MagentoFrameworkViewLayoutReaderContext), Object(MagentoFrameworkViewLayoutGeneratorContext))
#9 /var/www/html/appcustomizer-tshirt-M2/var/generation/Magento/Framework/View/Layout/Interceptor.php(89): MagentoFrameworkViewLayout->generateElements()
#10 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Layout/Builder.php(129): MagentoFrameworkViewLayoutInterceptor->generateElements()
#11 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Page/Builder.php(55): MagentoFrameworkViewLayoutBuilder->generateLayoutBlocks()
#12 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Layout/Builder.php(65): MagentoFrameworkViewPageBuilder->generateLayoutBlocks()
#13 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Layout.php(244): MagentoFrameworkViewLayoutBuilder->build()
#14 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Layout.php(859): MagentoFrameworkViewLayout->build()
#15 /var/www/html/appcustomizer-tshirt-M2/var/generation/Magento/Framework/View/Layout/Interceptor.php(414): MagentoFrameworkViewLayout->getBlock('menu')
#16 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/module-backend/Model/View/Result/Page.php(59): MagentoFrameworkViewLayoutInterceptor->getBlock('menu')
#17 /var/www/html/appcustomizer-tshirt-M2/var/generation/Magento/Backend/Model/View/Result/Page/Interceptor.php(24): MagentoBackendModelViewResultPage->setActiveMenu('Tomrain_Appcust...')
#18 /var/www/html/appcustomizer-tshirt-M2/app/code/Tomrain/Appcustomizer/Controller/Adminhtml/Clipartcategories/Index.php(36): MagentoBackendModelViewResultPageInterceptor->setActiveMenu('Tomrain_Appcust...')
#19 /var/www/html/appcustomizer-tshirt-M2/var/generation/Tomrain/Appcustomizer/Controller/Adminhtml/Clipartcategories/Index/Interceptor.php(25): TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndex->execute()
#20 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/App/Action/Action.php(102): TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor->execute()
#21 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/module-backend/App/AbstractAction.php(226): MagentoFrameworkAppActionAction->dispatch(Object(MagentoFrameworkAppRequestHttp))
#22 [internal function]: MagentoBackendAppAbstractAction->dispatch(Object(MagentoFrameworkAppRequestHttp))
#23 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Interceptor.php(74): call_user_func_array(Array, Array)
#24 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Chain/Chain.php(70): TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor->___callParent('dispatch', Array)
#25 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Chain/Chain.php(63): MagentoFrameworkInterceptionChainChain->invokeNext('Tomrain\Appcust...', 'dispatch', Object(TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor), Array, 'adminAuthentica...')
#26 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/module-backend/App/Action/Plugin/Authentication.php(143): MagentoFrameworkInterceptionChainChain->MagentoFrameworkInterceptionChainclosure(Object(MagentoFrameworkAppRequestHttp))
#27 [internal function]: MagentoBackendAppActionPluginAuthentication->aroundDispatch(Object(TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor), Object(Closure), Object(MagentoFrameworkAppRequestHttp))
#28 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Chain/Chain.php(67): call_user_func_array(Array, Array)
#29 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Chain/Chain.php(63): MagentoFrameworkInterceptionChainChain->invokeNext('Tomrain\Appcust...', 'dispatch', Object(TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor), Array, 'designLoader')
#30 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/App/Action/Plugin/Design.php(39): MagentoFrameworkInterceptionChainChain->MagentoFrameworkInterceptionChainclosure(Object(MagentoFrameworkAppRequestHttp))
#31 [internal function]: MagentoFrameworkAppActionPluginDesign->aroundDispatch(Object(TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor), Object(Closure), Object(MagentoFrameworkAppRequestHttp))
#32 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Chain/Chain.php(67): call_user_func_array(Array, Array)
#33 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Interceptor.php(138): MagentoFrameworkInterceptionChainChain->invokeNext('Tomrain\Appcust...', 'dispatch', Object(TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor), Array, 'adminMassaction...')
#34 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/module-backend/App/Action/Plugin/MassactionKey.php(33): TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor->MagentoFrameworkInterceptionclosure(Object(MagentoFrameworkAppRequestHttp))
#35 [internal function]: MagentoBackendAppActionPluginMassactionKey->aroundDispatch(Object(TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor), Object(Closure), Object(MagentoFrameworkAppRequestHttp))
#36 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Interceptor.php(142): call_user_func_array(Array, Array)
#37 /var/www/html/appcustomizer-tshirt-M2/var/generation/Tomrain/Appcustomizer/Controller/Adminhtml/Clipartcategories/Index/Interceptor.php(40): TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor->___callPlugins('dispatch', Array, Array)
#38 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/App/FrontController.php(55): TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor->dispatch(Object(MagentoFrameworkAppRequestHttp))
#39 [internal function]: MagentoFrameworkAppFrontController->dispatch(Object(MagentoFrameworkAppRequestHttp))
#40 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Interceptor.php(74): call_user_func_array(Array, Array)
#41 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Chain/Chain.php(70): MagentoFrameworkAppFrontControllerInterceptor->___callParent('dispatch', Array)
#42 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Interceptor.php(138): MagentoFrameworkInterceptionChainChain->invokeNext('Magento\Framewo...', 'dispatch', Object(MagentoFrameworkAppFrontControllerInterceptor), Array, 'install')
#43 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Module/Plugin/DbStatusValidator.php(69): MagentoFrameworkAppFrontControllerInterceptor->MagentoFrameworkInterceptionclosure(Object(MagentoFrameworkAppRequestHttp))
#44 [internal function]: MagentoFrameworkModulePluginDbStatusValidator->aroundDispatch(Object(MagentoFrameworkAppFrontControllerInterceptor), Object(Closure), Object(MagentoFrameworkAppRequestHttp))
#45 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Interceptor.php(142): call_user_func_array(Array, Array)
#46 /var/www/html/appcustomizer-tshirt-M2/var/generation/Magento/Framework/App/FrontController/Interceptor.php(26): MagentoFrameworkAppFrontControllerInterceptor->___callPlugins('dispatch', Array, Array)
#47 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/App/Http.php(115): MagentoFrameworkAppFrontControllerInterceptor->dispatch(Object(MagentoFrameworkAppRequestHttp))
#48 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/App/Bootstrap.php(258): MagentoFrameworkAppHttp->launch()
#49 /var/www/html/appcustomizer-tshirt-M2/index.php(42): MagentoFrameworkAppBootstrap->run(Object(MagentoFrameworkAppHttp))
Tomrain/Appcustomizer/Block/Adminhtml/Clipartcategories.php
namespace TomrainAppcustomizerBlockAdminhtml;
class Clipartcategories extends MagentoBackendBlockWidgetContainer
/**
* @var string
*/
protected $_template = 'clipartcategories/entries.phtml';
/**
* @param MagentoBackendBlockWidgetContext $context
* @param array $data
*/
public function __construct(
MagentoBackendBlockWidgetContext $context,
array $data = []
)
parent::__construct($context, $data);
/**
* Prepare button and grid
*
* @return MagentoCatalogBlockAdminhtmlProduct
*/
protected function _prepareLayout()
$addButtonProps = [
'id' => 'add_new_entry_post',
'label' => __('Add New'),
'class' => 'add',
'button_class' => '',
'class_name' => 'MagentoBackendBlockWidgetButtonSplitButton',
'options' => $this->_getAddButtonOptions(),
];
$this->buttonList->add('add_new', $addButtonProps);
$this->setChild(
'grid',
$this->getLayout()->createBlock('TomrainAppcustomizerBlockAdminhtmlClipartcategoriesGrid', 'appcustomizer.grid')
);
return parent::_prepareLayout();
/**
*
*
* @return array
*/
protected function _getAddButtonOptions()
$splitButtonOptions[] = [
'label' => __('Add New'),
'onclick' => "setLocation('" . $this->_getCreateUrl() . "')"
];
return $splitButtonOptions;
/**
*
*
* @param string $type
* @return string
*/
protected function _getCreateUrl()
return $this->getUrl(
'appcustomizer/*/new'
);
/**
* Render grid
*
* @return string
*/
public function getGridHtml()
return $this->getChildHtml('grid');
Tomrain/Appcustomizer/Block/Adminhtml/Clipartcategories/Grid.php
namespace TomrainAppcustomizerBlockAdminhtmlClipartcategories;
class Grid extends MagentoBackendBlockWidgetGridExtended
/**
* @var MagentoFrameworkModuleManager
*/
protected $moduleManager;
/**
* @var TomrainAppcustomizerModelClipartcategoriesFactory
*/
protected $_clipartcategoriesFactory;
protected $_status;
/**
* @param MagentoBackendBlockTemplateContext $context
* @param MagentoBackendHelperData $backendHelper
* @param TomrainAppcustomizerModelClipartcategoriesFactory $clipartcategoriesFactory
* @param TomrainAppcustomizerModelStatus $status
* @param MagentoFrameworkModuleManager $moduleManager
* @param array $data
*
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
public function __construct(
MagentoBackendBlockTemplateContext $context,
MagentoBackendHelperData $backendHelper,
TomrainAppcustomizerModelClipartcategoriesFactory $clipartcategoriesFactory,
TomrainAppcustomizerModelStatus $status,
MagentoFrameworkModuleManager $moduleManager,
array $data = []
)
$this->_clipartcategoriesFactory = $clipartcategoriesFactory;
$this->_status = $status;
$this->moduleManager = $moduleManager;
parent::__construct($context, $backendHelper, $data);
/**
* @return void
*/
protected function _construct()
parent::_construct();
$this->setId('postGrid');
$this->setDefaultSort('id');
$this->setDefaultDir('DESC');
$this->setSaveParametersInSession(true);
$this->setUseAjax(true);
$this->setVarNameFilter('post_filter');
/**
* @return $this
*/
protected function _prepareCollection()
$collection = $this->_clipartcategoriesFactory->create()->getCollection();
$this->setCollection($collection);
parent::_prepareCollection();
return $this;
/**
* @return $this
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
protected function _prepareColumns()
$this->addColumn(
'id',
[
'header' => __('ID'),
'type' => 'number',
'index' => 'id',
'header_css_class' => 'col-id',
'column_css_class' => 'col-id',
'name'=>'id'
]
);
$this->addColumn(
'label',
[
'header' => __('Category'),
'index' => 'label',
'class' => 'xxx',
'name'=>'label'
]
);
$this->addColumn(
'parent_id',
[
'header' => __('Parent Category'),
'index' => 'parent_id',
'class' => 'xxx',
'name'=>'parent_id',
'options' => $this->_status->_getAttributeOptions()
]
);
$this->addColumn(
'image',
array(
'header' => __('Image'),
'index' => 'image',
'renderer' => 'TomrainAppcustomizerBlockAdminhtmlInquiryGridRendererClipartcategories',
)
);
$this->addColumn(
'status',
[
'header' => __('Active'),
'index' => 'status',
'type' => 'options',
'name'=>'status',
'options' => $this->_status->getOptionArray()
]
);
$this->addColumn(
'edit',
[
'header' => __('Edit'),
'type' => 'action',
'getter' => 'getId',
'actions' => [
[
'caption' => __('Edit'),
'url' => [
'base' => '*/*/edit'
],
'field' => 'id'
]
],
'filter' => false,
'sortable' => false,
'index' => 'stores',
'header_css_class' => 'col-action',
'column_css_class' => 'col-action'
]
);
$block = $this->getLayout()->getBlock('grid.bottom.links');
if ($block)
$this->setChild('grid.bottom.links', $block);
return parent::_prepareColumns();
/**
* @return $this
*/
protected function _prepareMassaction()
$this->setMassactionIdField('id');
$this->getMassactionBlock()->setTemplate('Tomrain_Appcustomizer::clipartcategories/grid/massaction_extended.phtml');
$this->getMassactionBlock()->setFormFieldName('label');
$this->getMassactionBlock()->addItem(
'delete',
[
'label' => __('Delete'),
'url' => $this->getUrl('appcustomizer/*/massDelete'),
'confirm' => __('Are you sure?')
]
);
$statuses = $this->_status->getOptionArray();
array_unshift($statuses, ['label' => '', 'value' => '']);
$this->getMassactionBlock()->addItem(
'status',
[
'label' => __('Change status'),
'url' => $this->getUrl('appcustomizer/*/massStatus', ['_current' => true]),
'additional' => [
'visibility' => [
'name' => 'status',
'type' => 'select',
'class' => 'required-entry',
'label' => __('Status'),
'values' => $statuses
]
]
]
);
return $this;
/**
* @return string
*/
public function getGridUrl()
return $this->getUrl('appcustomizer/*/grid', ['_current' => true]);
public function getRowUrl($row)
return $this->getUrl(
'appcustomizer/*/edit',
['id' => $row->getId()]
);
magento2 module admin custom-grid
I've been trying to create custom gird in magento 2.0.11 but it keep returning Invalid block type:
This error occurs while executing the file Tomrain/Appcustomizer/Block/Adminhtml/Clipartcategories.php
in following code :
$this->setChild(
'grid',
$this->getLayout()->createBlock('TomrainAppcustomizerBlockAdminhtmlClipartcategoriesGrid', 'appcustomizer.grid')
);
But I have block TomrainAppcustomizerBlockAdminhtmlClipartcategoriesGrid
Invalid block type: TomrainAppcustomizerBlockAdminhtmlClipartcategoriesGrid
#0 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Layout/Generator/Block.php(237): MagentoFrameworkViewLayoutGeneratorBlock->getBlockInstance('Tomrain\Appcust...', Array)
#1 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Layout.php(760): MagentoFrameworkViewLayoutGeneratorBlock->createBlock('Tomrain\Appcust...', 'appcustomizer.g...', Array)
#2 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Layout.php(743): MagentoFrameworkViewLayout->_createBlock('Tomrain\Appcust...', 'appcustomizer.g...', Array)
#3 /var/www/html/appcustomizer-tshirt-M2/var/generation/Magento/Framework/View/Layout/Interceptor.php(349): MagentoFrameworkViewLayout->createBlock('Tomrain\Appcust...', 'appcustomizer.g...', Array)
#4 /var/www/html/appcustomizer-tshirt-M2/app/code/Tomrain/Appcustomizer/Block/Adminhtml/Clipartcategories.php(41): MagentoFrameworkViewLayoutInterceptor->createBlock('Tomrain\Appcust...', 'appcustomizer.g...')
#5 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Element/AbstractBlock.php(262): TomrainAppcustomizerBlockAdminhtmlClipartcategories->_prepareLayout()
#6 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Layout/Generator/Block.php(139): MagentoFrameworkViewElementAbstractBlock->setLayout(Object(MagentoFrameworkViewLayoutInterceptor))
#7 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Layout/GeneratorPool.php(86): MagentoFrameworkViewLayoutGeneratorBlock->process(Object(MagentoFrameworkViewLayoutReaderContext), Object(MagentoFrameworkViewLayoutGeneratorContext))
#8 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Layout.php(327): MagentoFrameworkViewLayoutGeneratorPool->process(Object(MagentoFrameworkViewLayoutReaderContext), Object(MagentoFrameworkViewLayoutGeneratorContext))
#9 /var/www/html/appcustomizer-tshirt-M2/var/generation/Magento/Framework/View/Layout/Interceptor.php(89): MagentoFrameworkViewLayout->generateElements()
#10 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Layout/Builder.php(129): MagentoFrameworkViewLayoutInterceptor->generateElements()
#11 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Page/Builder.php(55): MagentoFrameworkViewLayoutBuilder->generateLayoutBlocks()
#12 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Layout/Builder.php(65): MagentoFrameworkViewPageBuilder->generateLayoutBlocks()
#13 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Layout.php(244): MagentoFrameworkViewLayoutBuilder->build()
#14 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Layout.php(859): MagentoFrameworkViewLayout->build()
#15 /var/www/html/appcustomizer-tshirt-M2/var/generation/Magento/Framework/View/Layout/Interceptor.php(414): MagentoFrameworkViewLayout->getBlock('menu')
#16 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/module-backend/Model/View/Result/Page.php(59): MagentoFrameworkViewLayoutInterceptor->getBlock('menu')
#17 /var/www/html/appcustomizer-tshirt-M2/var/generation/Magento/Backend/Model/View/Result/Page/Interceptor.php(24): MagentoBackendModelViewResultPage->setActiveMenu('Tomrain_Appcust...')
#18 /var/www/html/appcustomizer-tshirt-M2/app/code/Tomrain/Appcustomizer/Controller/Adminhtml/Clipartcategories/Index.php(36): MagentoBackendModelViewResultPageInterceptor->setActiveMenu('Tomrain_Appcust...')
#19 /var/www/html/appcustomizer-tshirt-M2/var/generation/Tomrain/Appcustomizer/Controller/Adminhtml/Clipartcategories/Index/Interceptor.php(25): TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndex->execute()
#20 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/App/Action/Action.php(102): TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor->execute()
#21 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/module-backend/App/AbstractAction.php(226): MagentoFrameworkAppActionAction->dispatch(Object(MagentoFrameworkAppRequestHttp))
#22 [internal function]: MagentoBackendAppAbstractAction->dispatch(Object(MagentoFrameworkAppRequestHttp))
#23 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Interceptor.php(74): call_user_func_array(Array, Array)
#24 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Chain/Chain.php(70): TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor->___callParent('dispatch', Array)
#25 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Chain/Chain.php(63): MagentoFrameworkInterceptionChainChain->invokeNext('Tomrain\Appcust...', 'dispatch', Object(TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor), Array, 'adminAuthentica...')
#26 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/module-backend/App/Action/Plugin/Authentication.php(143): MagentoFrameworkInterceptionChainChain->MagentoFrameworkInterceptionChainclosure(Object(MagentoFrameworkAppRequestHttp))
#27 [internal function]: MagentoBackendAppActionPluginAuthentication->aroundDispatch(Object(TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor), Object(Closure), Object(MagentoFrameworkAppRequestHttp))
#28 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Chain/Chain.php(67): call_user_func_array(Array, Array)
#29 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Chain/Chain.php(63): MagentoFrameworkInterceptionChainChain->invokeNext('Tomrain\Appcust...', 'dispatch', Object(TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor), Array, 'designLoader')
#30 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/App/Action/Plugin/Design.php(39): MagentoFrameworkInterceptionChainChain->MagentoFrameworkInterceptionChainclosure(Object(MagentoFrameworkAppRequestHttp))
#31 [internal function]: MagentoFrameworkAppActionPluginDesign->aroundDispatch(Object(TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor), Object(Closure), Object(MagentoFrameworkAppRequestHttp))
#32 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Chain/Chain.php(67): call_user_func_array(Array, Array)
#33 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Interceptor.php(138): MagentoFrameworkInterceptionChainChain->invokeNext('Tomrain\Appcust...', 'dispatch', Object(TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor), Array, 'adminMassaction...')
#34 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/module-backend/App/Action/Plugin/MassactionKey.php(33): TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor->MagentoFrameworkInterceptionclosure(Object(MagentoFrameworkAppRequestHttp))
#35 [internal function]: MagentoBackendAppActionPluginMassactionKey->aroundDispatch(Object(TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor), Object(Closure), Object(MagentoFrameworkAppRequestHttp))
#36 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Interceptor.php(142): call_user_func_array(Array, Array)
#37 /var/www/html/appcustomizer-tshirt-M2/var/generation/Tomrain/Appcustomizer/Controller/Adminhtml/Clipartcategories/Index/Interceptor.php(40): TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor->___callPlugins('dispatch', Array, Array)
#38 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/App/FrontController.php(55): TomrainAppcustomizerControllerAdminhtmlClipartcategoriesIndexInterceptor->dispatch(Object(MagentoFrameworkAppRequestHttp))
#39 [internal function]: MagentoFrameworkAppFrontController->dispatch(Object(MagentoFrameworkAppRequestHttp))
#40 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Interceptor.php(74): call_user_func_array(Array, Array)
#41 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Chain/Chain.php(70): MagentoFrameworkAppFrontControllerInterceptor->___callParent('dispatch', Array)
#42 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Interceptor.php(138): MagentoFrameworkInterceptionChainChain->invokeNext('Magento\Framewo...', 'dispatch', Object(MagentoFrameworkAppFrontControllerInterceptor), Array, 'install')
#43 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Module/Plugin/DbStatusValidator.php(69): MagentoFrameworkAppFrontControllerInterceptor->MagentoFrameworkInterceptionclosure(Object(MagentoFrameworkAppRequestHttp))
#44 [internal function]: MagentoFrameworkModulePluginDbStatusValidator->aroundDispatch(Object(MagentoFrameworkAppFrontControllerInterceptor), Object(Closure), Object(MagentoFrameworkAppRequestHttp))
#45 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/Interception/Interceptor.php(142): call_user_func_array(Array, Array)
#46 /var/www/html/appcustomizer-tshirt-M2/var/generation/Magento/Framework/App/FrontController/Interceptor.php(26): MagentoFrameworkAppFrontControllerInterceptor->___callPlugins('dispatch', Array, Array)
#47 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/App/Http.php(115): MagentoFrameworkAppFrontControllerInterceptor->dispatch(Object(MagentoFrameworkAppRequestHttp))
#48 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/App/Bootstrap.php(258): MagentoFrameworkAppHttp->launch()
#49 /var/www/html/appcustomizer-tshirt-M2/index.php(42): MagentoFrameworkAppBootstrap->run(Object(MagentoFrameworkAppHttp))
Tomrain/Appcustomizer/Block/Adminhtml/Clipartcategories.php
namespace TomrainAppcustomizerBlockAdminhtml;
class Clipartcategories extends MagentoBackendBlockWidgetContainer
/**
* @var string
*/
protected $_template = 'clipartcategories/entries.phtml';
/**
* @param MagentoBackendBlockWidgetContext $context
* @param array $data
*/
public function __construct(
MagentoBackendBlockWidgetContext $context,
array $data = []
)
parent::__construct($context, $data);
/**
* Prepare button and grid
*
* @return MagentoCatalogBlockAdminhtmlProduct
*/
protected function _prepareLayout()
$addButtonProps = [
'id' => 'add_new_entry_post',
'label' => __('Add New'),
'class' => 'add',
'button_class' => '',
'class_name' => 'MagentoBackendBlockWidgetButtonSplitButton',
'options' => $this->_getAddButtonOptions(),
];
$this->buttonList->add('add_new', $addButtonProps);
$this->setChild(
'grid',
$this->getLayout()->createBlock('TomrainAppcustomizerBlockAdminhtmlClipartcategoriesGrid', 'appcustomizer.grid')
);
return parent::_prepareLayout();
/**
*
*
* @return array
*/
protected function _getAddButtonOptions()
$splitButtonOptions[] = [
'label' => __('Add New'),
'onclick' => "setLocation('" . $this->_getCreateUrl() . "')"
];
return $splitButtonOptions;
/**
*
*
* @param string $type
* @return string
*/
protected function _getCreateUrl()
return $this->getUrl(
'appcustomizer/*/new'
);
/**
* Render grid
*
* @return string
*/
public function getGridHtml()
return $this->getChildHtml('grid');
Tomrain/Appcustomizer/Block/Adminhtml/Clipartcategories/Grid.php
namespace TomrainAppcustomizerBlockAdminhtmlClipartcategories;
class Grid extends MagentoBackendBlockWidgetGridExtended
/**
* @var MagentoFrameworkModuleManager
*/
protected $moduleManager;
/**
* @var TomrainAppcustomizerModelClipartcategoriesFactory
*/
protected $_clipartcategoriesFactory;
protected $_status;
/**
* @param MagentoBackendBlockTemplateContext $context
* @param MagentoBackendHelperData $backendHelper
* @param TomrainAppcustomizerModelClipartcategoriesFactory $clipartcategoriesFactory
* @param TomrainAppcustomizerModelStatus $status
* @param MagentoFrameworkModuleManager $moduleManager
* @param array $data
*
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
public function __construct(
MagentoBackendBlockTemplateContext $context,
MagentoBackendHelperData $backendHelper,
TomrainAppcustomizerModelClipartcategoriesFactory $clipartcategoriesFactory,
TomrainAppcustomizerModelStatus $status,
MagentoFrameworkModuleManager $moduleManager,
array $data = []
)
$this->_clipartcategoriesFactory = $clipartcategoriesFactory;
$this->_status = $status;
$this->moduleManager = $moduleManager;
parent::__construct($context, $backendHelper, $data);
/**
* @return void
*/
protected function _construct()
parent::_construct();
$this->setId('postGrid');
$this->setDefaultSort('id');
$this->setDefaultDir('DESC');
$this->setSaveParametersInSession(true);
$this->setUseAjax(true);
$this->setVarNameFilter('post_filter');
/**
* @return $this
*/
protected function _prepareCollection()
$collection = $this->_clipartcategoriesFactory->create()->getCollection();
$this->setCollection($collection);
parent::_prepareCollection();
return $this;
/**
* @return $this
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
protected function _prepareColumns()
$this->addColumn(
'id',
[
'header' => __('ID'),
'type' => 'number',
'index' => 'id',
'header_css_class' => 'col-id',
'column_css_class' => 'col-id',
'name'=>'id'
]
);
$this->addColumn(
'label',
[
'header' => __('Category'),
'index' => 'label',
'class' => 'xxx',
'name'=>'label'
]
);
$this->addColumn(
'parent_id',
[
'header' => __('Parent Category'),
'index' => 'parent_id',
'class' => 'xxx',
'name'=>'parent_id',
'options' => $this->_status->_getAttributeOptions()
]
);
$this->addColumn(
'image',
array(
'header' => __('Image'),
'index' => 'image',
'renderer' => 'TomrainAppcustomizerBlockAdminhtmlInquiryGridRendererClipartcategories',
)
);
$this->addColumn(
'status',
[
'header' => __('Active'),
'index' => 'status',
'type' => 'options',
'name'=>'status',
'options' => $this->_status->getOptionArray()
]
);
$this->addColumn(
'edit',
[
'header' => __('Edit'),
'type' => 'action',
'getter' => 'getId',
'actions' => [
[
'caption' => __('Edit'),
'url' => [
'base' => '*/*/edit'
],
'field' => 'id'
]
],
'filter' => false,
'sortable' => false,
'index' => 'stores',
'header_css_class' => 'col-action',
'column_css_class' => 'col-action'
]
);
$block = $this->getLayout()->getBlock('grid.bottom.links');
if ($block)
$this->setChild('grid.bottom.links', $block);
return parent::_prepareColumns();
/**
* @return $this
*/
protected function _prepareMassaction()
$this->setMassactionIdField('id');
$this->getMassactionBlock()->setTemplate('Tomrain_Appcustomizer::clipartcategories/grid/massaction_extended.phtml');
$this->getMassactionBlock()->setFormFieldName('label');
$this->getMassactionBlock()->addItem(
'delete',
[
'label' => __('Delete'),
'url' => $this->getUrl('appcustomizer/*/massDelete'),
'confirm' => __('Are you sure?')
]
);
$statuses = $this->_status->getOptionArray();
array_unshift($statuses, ['label' => '', 'value' => '']);
$this->getMassactionBlock()->addItem(
'status',
[
'label' => __('Change status'),
'url' => $this->getUrl('appcustomizer/*/massStatus', ['_current' => true]),
'additional' => [
'visibility' => [
'name' => 'status',
'type' => 'select',
'class' => 'required-entry',
'label' => __('Status'),
'values' => $statuses
]
]
]
);
return $this;
/**
* @return string
*/
public function getGridUrl()
return $this->getUrl('appcustomizer/*/grid', ['_current' => true]);
public function getRowUrl($row)
return $this->getUrl(
'appcustomizer/*/edit',
['id' => $row->getId()]
);
magento2 module admin custom-grid
magento2 module admin custom-grid
edited yesterday
Muhammad Anas
550317
550317
asked May 10 '17 at 8:28
user54031user54031
1
1
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
$this->getLayout()->createBlock('TomrainAppcustomizerBlockAdminhtmlClipartcategoriesGrid', 'appcustomizer.grid');
please check with above code.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
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
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f173764%2fmagento-2-invalid-block-type-while-creating-custom-grid-in-backend%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
$this->getLayout()->createBlock('TomrainAppcustomizerBlockAdminhtmlClipartcategoriesGrid', 'appcustomizer.grid');
please check with above code.
add a comment |
$this->getLayout()->createBlock('TomrainAppcustomizerBlockAdminhtmlClipartcategoriesGrid', 'appcustomizer.grid');
please check with above code.
add a comment |
$this->getLayout()->createBlock('TomrainAppcustomizerBlockAdminhtmlClipartcategoriesGrid', 'appcustomizer.grid');
please check with above code.
$this->getLayout()->createBlock('TomrainAppcustomizerBlockAdminhtmlClipartcategoriesGrid', 'appcustomizer.grid');
please check with above code.
edited May 10 '17 at 8:35
Rakesh Jesadiya
30.2k1577124
30.2k1577124
answered May 10 '17 at 8:29
Sunil PatelSunil Patel
1,3781612
1,3781612
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f173764%2fmagento-2-invalid-block-type-while-creating-custom-grid-in-backend%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown