指南
- 介绍
- Contribute
- 部署
- 管理
- 高级
内部文档
扩展
- Main 核心概念
- 参考指南
- 进阶指南
- 更新指南
Updating For Beta 15
Beta 15 features multiple new extenders, a total redesign of the admin dashboard, and several other interesting new features for extensions. As before, we have done our best to provide backwards compatibility layers, and we recommend switching away from deprecated systems as soon as possible to make your extensions more stable.
提示If you need help applying these changes or using new features, please start a discussion on the community forum or Discord chat.
New Features / Deprecations
扩展器
Flarum\Api\Event\WillGetData
andFlarum\Api\Event\WillSerializeData
have been deprecated, theApiController
extender should be used insteadFlarum\Api\Event\Serializing
andFlarum\Event\GetApiRelationship
have been deprecated, theApiSerializer
extender should be used insteadFlarum\Formatter\Event\Parsing
has been deprecated, theparse
method of theFormatter
extender should be used insteadFlarum\Formatter\Event\Rendering
has been deprecated, therender
method of theFormatter
extender should be used insteadFlarum\Notification\Event\Sending
has been deprecated, thedriver
method of theNotification
extender should be used instead- Please note that the new notification driver system is not an exact analogue of the old
Sending
event, as it can only add new drivers, not change the functionality of the default notification bell alert driver. If your extension needs to modify how or to whom notifications are sent, you may need to replaceFlarum\Notification\NotificationSyncer
on the service provider level
- Please note that the new notification driver system is not an exact analogue of the old
Flarum\Event\ConfigureNotificationTypes
has been deprecated, thetype
method of theNotification
extender should be used insteadFlarum\Event\ConfigurePostTypes
has been deprecated, thetype
method of thePost
extender should be used insteadFlarum\Post\Event\CheckingForFlooding
has been deprecated, as well asFlarum\Post\Floodgate
. They have been replaced with a middleware-based throttling system that applies to ALL requests to /api/*, and can be configured via theThrottleApi
extender. Please see our api-throttling documentation for more information.Flarum\Event\ConfigureUserPreferences
has been deprecated, theregisterPreference
method of theUser
extender should be used insteadFlarum\Foundation\Event\Validating
has been deprecated, theconfigure
method of theValidator
extender should be used insteadThe Policy system has been reworked a bit to be more intuitive. Previously, policies contained both actual policies, which determine whether a user can perform some ability, and model visibility scopers, which allowed efficient restriction of queries to only items that users have access to. See the authorization documentation for more information on how to use the new systems. Now:
Flarum\Event\ScopeModelVisibility
has been deprecated. New scopers can be registered via theModelVisibility
extender, and anyEloquent\Builder
query can be scoped by calling thewhereVisibleTo
method on it, with the ability in question as an optional 2nd argument (defaults toview
).Flarum\Event\GetPermission
has been deprecated. Policies can be registered via thePolicy
extender.Flarum\User\User::can
has not changed. Please note that the new policies must return one of$this->allow()
,$this->deny()
,$this->forceAllow()
,$this->forceDeny()
, not a boolean.
A
ModelUrl
extender has been added, allowing new slug drivers to be registered. This accompanies Flarum's new slug driving system, which allows for extensions to define custom slugging strategies for sluggable models. The extender supports sluggable models outside of Flarum core. Please see our model slugging documentation for more information.A
Settings
extender has been added, whoseserializeToForum
method makes it easy to serialize a setting to the forum.A
ServiceProvider
extender has been added. This should be used with extreme caution for advanced use cases only, where there is no alternative. Please note that the service provider layer is not considered public API, and is liable to change at any time, without notice.
Admin UX Redesign
The admin dashboard has been completely redesigned, with a focus on providing navbar pages for each extension. The API for extensions to register settings, permissions, and custom pages has also been greatly simplified. You can also now update your extension's composer.json
to provide links for funding, support, website, etc that will show up on your extension's admin page. Please see our Admin JS documentation for more information on how to use the new system.
Other New Features
- On the backend, the route name is now available via
$request->getAttribute('routeName')
for controllers, and for middleware that run afterFlarum\Http\Middleware\ResolveRoute.php
. Flarum\Api\Controller\UploadImageController.php
can now be used as a base class for controllers that upload images (like for the logo and favicon).- Automatic browser scroll restoration can now be disabled for individual pages see our frontend page documentation for more info.
Breaking Changes
- The following deprecated frontend BC layers were removed:
momentjs
no longer works as an alias fordayjs
this.props
andthis.initProps
no longer aliasthis.attrs
andthis.initAttrs
for theComponent
base classm.withAttr
andm.stream
no longer aliasflarum/utils/withAttr
andflarum/utils/Stream
app.cache.discussionList
has been removedthis.content
andthis.editor
have been removed fromComposerBody
this.component
,this.content
, andthis.value
have been removed fromComposerState
- The following deprecated backend BC layers were removed:
- The
publicPath
,storagePath
, andvendorPath
methods ofFlarum\Foundation\Application
have been removed - The
base_path
,public_path
, andstorage_path
global helpers have been removed - The
getEmailSubject
method ofFlarum\Notification\MailableInterface
MUST now take a translator instance as an argument Flarum\User\AssertPermissionTrait
has been removed, the analogous methods onFlarum\User\User
should be used instead- The
Flarum\Event\PrepareUserGroups
event has been removed, use theUser
extender instead - The
Flarum\User\Event\GetDisplayName
event has been removed, use the display name driver feature of theUser
extender instead
- The
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论