Upgrading to Hyvä Commerce 1.2.0
The 1.2.0 release for Hyvä Commerce introduces the GA (General Availability) versions of the Admin Dashboard and Media Optimisation features
Notable news
Admin Dashboard 1.0.0 revitalizes the Magento admin panel's dashboard. It contains our initial batch of widgets. Dashboards are user specific, allowing admin users to display the data relevant to them, with the ability to configure options, resize and reorder every widget instance. See our Admin Dashboard Widgets page for more details.
Media Optimisation 1.0.0 adds the ability to automatically replace images across the storefront, along with a developer API. Images can be resized to admin configurable sizes, and converted to WebP and AVIF formats. It includes support for animated GIFs (as WebP), the GD and Imagick image libraries, logging, along with a huge range of admin configuration, as well as a system check tool to ensure your server meets the minimum requirements.
Admin Dashboard
There are a number of backwards-incompatible changes for the admin dashboard module(s). Below are a list of affected components, how they have been changed, and the steps required to update any customizations or widget implementations.
Widget Type Interface
Class: Hyva\AdminDashboardFramework\Model\WidgetType\WidgetTypeInterface
Added
getTitle(?WidgetInstanceInterface $widgetInstance)function originally only declared in theAbstractWidgetTypeclassgetProperties(string $propertyType)function to replace separategetConfigurablePropertiesandgetDisplayPropertiesfunctionsgetPropertyByName(string $propertyType, string $propertyName)function to replace separategetConfigurablePropertyByNameandgetDisplayPropertyByNamefunctionsgetTrailingAction(?WidgetInstanceInterface $widgetInstance)function to provide trailing action configuration array- Constants to reference new configuration keys
- Constant to reference the default widget category name
Changed
getDisplayData()parameter is no longer nullable, aWidgetInstanceInterfaceobject is now required
Removed
getConfigurablePropertyByName()andgetDisplayPropertyByName()functions- These are replaced by the aforementioned generic
getPropertyByName()function
- These are replaced by the aforementioned generic
Updating
Any class implementing WidgetTypeInterface directly must:
- Add
getTitle(?WidgetInstanceInterface $widgetInstance): Phrase - Add
getProperties(string $propertyType): array - Add
getPropertyByName(string $propertyType, string $propertyName): ?array - Add
getTrailingAction(?WidgetInstanceInterface $widgetInstance): array - Change
getDisplayData()parameter from nullable to non-nullable - Remove
getConfigurablePropertyByName()andgetDisplayPropertyByName()
Abstract Widget Type
Class: Hyva\AdminDashboardFramework\Model\WidgetType\AbstractWidgetType
Added
- Added new
?WidgetInstanceInterface $widgetInstanceparameter to thegetTitle()function - Default implementation for the
getProperties()function which returns the input properties by key - Default implementation for the
getPropertyByName()function which returns the input property of a given type and name - Default implementation for the
getTrailingAction()function which returns an array of link data for the trailing action feature
Changed
- Updated the constructor to replace the
Magento\Backend\Model\AuthandMagento\Framework\AuthorizationInterfacedependencies withHyva\AdminDashboardFramework\Model\WidgetAuth- Also replaced uses of the former dependencies in the
isAllowed()function with calls to the relevant functions in theWidgetAuthclass
- Also replaced uses of the former dependencies in the
- The
getDisplayData()function is now abstract, rather than returningnull
Removed
- Default/global
descriptiondisplay property getConfigurablePropertyByName()functiongetDisplayPropertyByName()function
Updating
Classes extending AbstractWidgetType must:
- Update the constructor to pass
WidgetAuthandWidgetConfig(in that order) toparent::__construct() - Replace any
$this->adminAuthwith$this->widgetAuth->getAdminAuthModel() - Replace any
$this->requestAuthwith$this->widgetAuth->getRequestAuth() - Implement
getDisplayData(WidgetInstanceInterface $widgetInstance)if not already - If relying on the previously default
descriptiondisplay property, add it to the widget type'sgetDisplayProperties()override
Widget Instance Interface
Class: Hyva\AdminDashboardFramework\Model\WidgetInstance\WidgetInstanceInterface
Added
getPropertyValues(string $propertyType)function to replace separategetConfigurablePropertyValuesandgetDisplayPropertyValuesfunctionsgetPropertyValue(string $propertyType, string $propertyName)function to replace separategetConfigurablePropertyValueandgetDisplayPropertyValuefunctions
Changed
- Nothing changed
Removed
getConfigurablePropertyValues()andgetDisplayPropertyValues()functions- These are replaced by the aforementioned generic
getPropertyValues()function
- These are replaced by the aforementioned generic
getConfigurablePropertyValue()andgetDisplayPropertyValue()functions- These are replaced by the aforementioned generic
getPropertyValue()function
- These are replaced by the aforementioned generic
Updating
Any class implementing WidgetInstanceInterface directly must:
- Replace all calls to
getConfigurablePropertyValue('foo')withgetPropertyValue(WidgetTypeInterface::KEY_CONFIGURABLE_PROPERTIES, 'foo') - Replace all calls to
getDisplayPropertyValue('foo')withgetPropertyValue(WidgetTypeInterface::KEY_DISPLAY_PROPERTIES, 'foo')
Widget Instance Model
Class: Hyva\AdminDashboardFramework\Model\WidgetInstance\WidgetInstance
Added
- New constructor argument
Hyva\AdminDashboardFramework\Model\Cache\Type\AdminDashboard $adminDashboardCache - Implementation for the
getPropertyValues()function which returns the input property values by key - Implementation for the
getPropertyValue()function which returns the input property value of a given type and name
Changed
getDisplayData()function now takes a boolean$loadFromCacheargument, which defaults totrueand determines whether to serve the display data from thehyva_admin_dashboardcache
Removed
getConfigurablePropertyValues()functiongetDisplayPropertyValues()functiongetConfigurablePropertyValue()functiongetDisplayPropertyValue()function
Updating
If you have overridden or decorated WidgetInstance, inject AdminDashboardCache and update the getDisplayData()
signature to make the parameter non-nullable.
Base Widget Classes
Classes:
- Hyva\AdminDashboardBaseWidgets\Model\Widget\BarChart
- Hyva\AdminDashboardBaseWidgets\Model\Widget\LineChart
- Hyva\AdminDashboardBaseWidgets\Model\Widget\Number
- Hyva\AdminDashboardBaseWidgets\Model\Widget\PieChart
Added
- Nothing added
Changed
- Defined each of the aforementioned classes as abstract
Removed
- Nothing removed
Updating
Update any of your references to the base classes mentioned above to add the Abstract prefix to their class names.
Widget Configuration
Added
cache_lifetimeXML configuration optionfull_screenXML configuration optiontrailing_actionXML configuration option- Added new
$defaultCacheLifetimeconstructor argument toHyva\AdminDashboardFramework\Model\Config\Widget\Converter - Added new
$categoryNamesconstructor argument toHyva\AdminDashboardFramework\Model\Config\Widget\Converter
Changed
- Configuration file renamed from
dashboard_widget.xmltohyva_dashboard_widget.xml - Fixed a bug that disallowed underscores in
<template>values - Require widget categories to be defined via
di.xml
Removed
- Nothing removed
Updating
Rename any custom widget XML files from dashboard_widget.xml to hyva_dashboard_widget.xml and update their XSD
references.
Widget Display Types
Added
- New
tabledisplay type
Changed
- Updated
checklistwidget configuration to use thetemplatedisplay type - Updated
linkswidget configuration to use thetemplatedisplay type - Updated
textwidget configuration to use thetemplatedisplay type
Removed
- Dedicated
checklistdisplay type - Dedicated
linksdisplay type - Dedicated
textdisplay type
Updating
If you created custom widgets using the checklist, links, or text display types, change them to use the template
display type instead and add an explicit <template> element to use the corresponding Hyva_AdminDashboardBaseWidgets
template file.
System Configuration
Added
- New section for toast message configuration
- New section for chart theme configuration
Changed
- Changed
hyva_admin_dashboard/general/widget_dashboard_positiontohyva_admin_dashboard/general/dashboard_position - Updated default value for
hyva_admin_dashboard/general/keep_defaultfrom1to0 - Updated default value for
hyva_admin_dashboard/general/dashboard_positionfrombeforetoafter - Updated default value for
hyva_admin_dashboard/developer/batching/max_batch_sizefrom8to4 - Updated default value for
hyva_admin_dashboard/developer/batching/max_concurrent_requestsfrom1to3
Removed
- Nothing removed
Updating
If you reference the admin dashboard configuration paths in your own code, update widget_dashboard_position to
dashboard_position.
Hyvä Media Optimisation
Viewport Breakpoints
Media Optimisation's auto replace now supports configuring responsive image sizes based on viewport width, ensuring smaller screens receive appropriately sized images rather than full-resolution versions. This way images have a far better chance of being the right size for the viewport. Especially mobile pages will benefit from not loading images larger than the screen size.
Breakpoints are configured in Stores > Configuration > Hyvä Commerce > Media Optimisation > Viewport Breakpoints. Each row defines a minimum viewport width, an optional maximum viewport width, and the generated image width to serve for that range. Images are never generated larger than the original source.
Viewport Breakpoints are applied when using the Developer API or Automatic Image Replacement in picture mode. They are not applied in simple replacement mode. For more information, see the Viewport Breakpoints configuration documentation.
Debug Logging
Because images are loaded on every page load a small error can result in logs filling up quickly. Because of this we moved the logs to a separate log file.
Changelogs
The changelog is available here.
Known Issues
- None so far