Widget Instances
When an admin user adds a widget to their dashboard, a widget instance is created. Widget instances are associated
with a particular admin user, are stored in the hyva_admin_dashboard_widget_instance table and each instance object
implements Hyva\AdminDashboardFramework\Model\WidgetInstance\WidgetInstanceInterface. The
Hyva\AdminDashboardFramework\Model\WidgetInstance\WidgetInstance class extends from Magento's AbstractModel and is
the concrete implementation of the WidgetInstanceInterface.
Widget Instance Interface Reference
The WidgetInstanceInterface provides getter and setter functions for the values stored in each of the
hyva_admin_dashboard_widget_instance table's columns (e.g. getInstanceId(), setConfiguration(array $config) etc.)
as well as the following utility functions:
getConfigurationJson()
This function returns the raw JSON string representing the widget instance configuration, whereas the "default"
getConfiguration() function returns the instance configuration as an associative array.
getPropertyValues()
If the widget instance contains a property set which matches the given $propertyType, this function returns an
associative array containing the properties and their values - otherwise it returns an empty array.
getPropertyValue()
If the widget instance contains a property set which matches the given $propertyType and that set contains a property
which matches the given $propertyName, this function returns the corresponding property input value - otherwise it
returns null.
getDisplayData()
This function acts as a proxy for the getDisplayData() function of the widget
instance's associated widget type - removing the need for developers to access the widget type object directly.
The function also attempts to serve previously generated content from the hyva_admin_dashboard cache. If a cached
value exists, it is returned - otherwise the content is generated and a new cache entry is created.
getWidgetType()
This function provides access to the widget instance's associated widget type object.