Log in
Model

Instance

Magento\Widget\Model\Widget\Instance

What it does

This model represents a widget instance in Magento 2, managing the configuration and placement of widgets throughout the store.

Developers use this class when programmatically creating, updating, or managing widget instances, handling widget parameters, template assignments, and generating the XML layout updates needed to display widgets in specific containers and pages.

Public Methods

  • beforeSave()
  • validate()
  • isCompleteToCreate()
  • getCode()
  • setCode()
  • setType()
  • getType()
  • getArea()
  • getStoreIds()
  • getWidgetParameters()
  • getWidgetsOptionArray()
  • getWidgetReference()
  • getWidgetConfigAsArray()
  • getWidgetTemplates()
  • getWidgetSupportedContainers()
  • getWidgetSupportedTemplatesByContainer()
  • generateLayoutUpdateXml()
  • afterSave()
  • beforeDelete()