Log in
Model

Widget

Magento\Widget\Model\Widget

What it does

This model manages Magento 2 widget configurations and functionality.

Developers use it to retrieve widget definitions from XML config, generate widget declarations for WYSIWYG editors, get widget placeholder images, and prepare widget parameters.

It's the central class for working with widgets programmatically, whether creating new widgets, rendering them in content, or managing widget metadata.

Public Methods

  • getWidgetByClassType()
  • getConfigAsXml()
  • getConfigAsObject()
  • getWidgets()
  • getWidgetsArray()
  • getWidgetDeclaration()
  • getPlaceholderImageUrl()
  • getPlaceholderImageUrls()