Hook: widgets.register_types

Last updated on May 20, 2026 19:06

Overview

Type: Action Location: app/Providers/AppServiceProvider.php

Register custom widget types into the widget system. Called during application boot. Themes and modules use this to add their own widgets to the admin widget manager.

Parameters

Param Type Description
$widgetManager WidgetManager Widget manager instance

Usage Example

Hook::addAction('widgets.register_types', function ($manager) {
    $manager->registerType('store_locator', [
        'label' => 'Store Locator',
        'description' => 'Map showing store locations',
        'fields' => [
            'api_key' => ['type' => 'text', 'label' => 'Google Maps API Key'],
            'zoom' => ['type' => 'number', 'label' => 'Default Zoom', 'default' => 12],
        ],
        'view' => 'widgets.store-locator',
    ]);
});

Related Hooks