Overview
anchor

As mentioned in the changelog, with this release, we’ve removed a couple of frontend and backend JavaScript APIs that were marked as deprecated in previous releases.

In this guide, we’ll go through the list of deprecated APIs and their replacements.

Headless CMS
anchor

Removed Methods Related to Checking Security Permissions (Performing Authorization)
anchor

We’ve removed a set of methods related to checking security permissions (performing authorization) that were accessible via the context.cms.permissions object. To provide more context, here’s an example of how the object could’ve been used in a simple CmsGraphQLSchemaPlugin plugin:

In the example above, the context.cms.permissions.entries.ensure method is used to check if the current user has the required permissions to read entries.

With this release, the context.cms.permissions object has been removed. Instead, you should use the context.cms.accessControl object to perform the same checks.

With this 5.39.2 release, we’ve introduced a new property on the CMS context object, called accessControl. Essentially, this property is a reference to the AccessControlexternal link class instance, which is used to perform authorization checks on content model groups, models, and entries.

If we were to rewrite the previous example using the new context.cms.accessControl object, it would look like this:

RenamedcreateCmsModelandcreateCmsGroupPlugin Factory Functions
anchor

We’ve renamed the createCmsModel and createCmsGroup plugin factory functions to createCmsModelPlugin and createCmsGroupPlugin. By having a more explicit name of the function, we’re making it more clear what the function actually does.

With the 5.40.0 release, the old functions will be still available, but do note that they will be removed in the upcoming quarterly (5.41.0) release.

Page Builder
anchor

Multiple legacy methods used for subscribing to Page Builder application’s lifecycle events have been removed.

Learn more about lifecycle events in the Lifecycle Events article.

Pages
anchor

Deprecated APIDescriptionReplacement API
onBeforePageCreateTriggered before a page is createdonPageBeforeCreate
onAfterPageCreateTriggered after a page is createdonPageAfterCreate
onBeforePageCreateFromTriggered before a page is created from a page revisiononPageBeforeCreateFrom
onAfterPageCreateFromTriggered after a page is created from a page revisiononPageAfterCreateFrom
onBeforePageUpdateTriggered before a page is updatedonPageBeforeUpdate
onAfterPageUpdateTriggered after a page is updatedonPageAfterUpdate
onBeforePageDeleteTriggered before a page is deletedonPageBeforeDelete
onAfterPageDeleteTriggered after a page is deletedonPageAfterDelete
onBeforePagePublishTriggered before a page is publishedonPageBeforePublish
onAfterPagePublishTriggered after a page is publishedonPageAfterPublish
onBeforePageUnpublishTriggered before a page is unpublishedonPageBeforeUnpublish
onAfterPageUnpublishTriggered after a page is unpublishedonPageAfterUnpublish

Menus
anchor

Deprecated APIDescriptionReplacement API
onBeforeMenuCreateTriggered before a menu is createdonMenuBeforeCreate
onAfterMenuCreateTriggered after a menu is createdonMenuAfterCreate
onBeforeMenuUpdateTriggered before a menu is updatedonMenuBeforeUpdate
onAfterMenuUpdateTriggered after a menu is updatedonMenuAfterUpdate
onBeforeMenuDeleteTriggered before a menu is deletedonMenuBeforeDelete
onAfterMenuDeleteTriggered after a menu is deletedonMenuAfterDelete

Page Categories
anchor

Deprecated APIDescriptionReplacement API
onBeforeCategoryCreateTriggered before a category is createdonCategoryBeforeCreate
onAfterCategoryCreateTriggered after a category is createdonCategoryAfterCreate
onBeforeCategoryUpdateTriggered before a category is updatedonCategoryBeforeUpdate
onAfterCategoryUpdateTriggered after a category is updatedonCategoryAfterUpdate
onBeforeCategoryDeleteTriggered before a category is deletedonCategoryBeforeDelete
onAfterCategoryDeleteTriggered after a category is deletedonCategoryAfterDelete

Page Builder Settings
anchor

Deprecated APIDescriptionReplacement API
onBeforeSettingsUpdateTriggered before Page Builder settings are updatedonSettingsBeforeUpdate
onAfterSettingsUpdateTriggered after Page Builder settings are updatedonSettingsAfterUpdate

Page Builder Installation
anchor

Deprecated APIDescriptionReplacement API
onBeforeInstallTriggered before Page Builder is installedonSystemBeforeInstall
onAfterInstallTriggered after Page Builder is installedonSystemAfterInstall

AppPbWebsiteSettingsReplaced WithWebsiteSettingsConfig
anchor

AddPbWebsiteSettings component to add website settings was replaced by WebsiteSettingsConfig. This was done to enable more features, and more control over the website settings view.

Until this release, you would use AddPbWebsiteSettings like this:

If we were to rewrite the previous example using WebsiteSettingsConfig, it would look like this:

Notice how, besides the code itself, the import changed; the WebsiteSettingsConfig is now imported from @webiny/app-page-builder. With this new config, we recommend creating dedicated components for your elements. Usage of children prop is no longer supported.

I18N
anchor

Multiple legacy methods used for subscribing to I18N application’s lifecycle events have been removed.

Locales
anchor

Deprecated APIDescriptionReplacement API
onBeforeLocaleCreateTriggered before a locale is createdonLocaleBeforeCreate
onAfterLocaleCreateTriggered after a locale is createdonLocaleAfterCreate
onBeforeLocaleUpdateTriggered before a locale is updatedonLocaleBeforeUpdate
onAfterLocaleUpdateTriggered after a locale is updatedonLocaleAfterUpdate
onBeforeLocaleDeleteTriggered before a locale is deletedonLocaleBeforeDelete
onAfterLocaleDeleteTriggered after a locale is deletedonLocaleAfterDelete

Installation
anchor

Deprecated APIDescriptionReplacement API
onBeforeInstallTriggered before Page Builder is installedonSystemBeforeInstall
onAfterInstallTriggered after Page Builder is installedonSystemAfterInstall

File Manager
anchor

RemovedFileManagerFileTypePluginClass
anchor

We’ve removed the FileManagerFileTypePlugin class, which was used to define custom file types in File Manager. More specifically, the class enabled developers to introduce custom file preview and custom file actions for all files of a specific type.

With this release, instead of using the FileManagerFileTypePlugin class, developers are encouraged to implement custom file preview and custom file actions using the new React components, both of which is covered in the following guides:

Forms
anchor

Removed theformObject FromBindComponent anduseBindHook
anchor

A reference to form was removed from the <Bind> component render prop, and useBind hook. You should now use the useForm hook to get a reference to the parent Form object. This was done to optimize re-rendering, and also make a clear separation between the form itself, and bindings to the UI.

Until this release, you could get a reference to the form instance from Bind’s render prop, like this:

Pre 5.40.

From 5.40.0 on, you will have to write this differently. More often than not, you’re adding new inputs to existing forms via plugins, so you’re just mounting <Bind> elements, or use the useBind hook. To get access to the form object, you’ll need to use the useForm hook, like this:

Post 5.40.