Skip to content

Commit

Permalink
Add LazyWidgetManager to replace ineffective WidgetManager.
Browse files Browse the repository at this point in the history
Changed the registration of widgets - now is used improved `LazyWidgetManager` and all widgets extend `BaseLazyWidget` class.

remp/crm#2075
  • Loading branch information
lubos-michalik committed Oct 6, 2022
1 parent d247e3e commit 6913ea1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
8 changes: 4 additions & 4 deletions src/AppleAppstoreModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Crm\ApplicationModule\DataProvider\DataProviderManager;
use Crm\ApplicationModule\SeederManager;
use Crm\ApplicationModule\User\UserDataRegistrator;
use Crm\ApplicationModule\Widget\WidgetManagerInterface;
use Crm\ApplicationModule\Widget\LazyWidgetManagerInterface;
use Crm\UsersModule\Auth\UserTokenAuthorization;
use League\Event\Emitter;
use Tomaj\Hermes\Dispatcher;
Expand Down Expand Up @@ -79,16 +79,16 @@ public function registerDataProviders(DataProviderManager $dataProviderManager)
);
}

public function registerWidgets(WidgetManagerInterface $widgetManager)
public function registerLazyWidgets(LazyWidgetManagerInterface $widgetManager)
{
$widgetManager->registerWidget(
'frontend.payments.listing.recurrent',
$this->getInstance(\Crm\AppleAppstoreModule\Components\StopRecurrentPaymentInfoWidget::class),
\Crm\AppleAppstoreModule\Components\StopRecurrentPaymentInfoWidget::class,
100
);
$widgetManager->registerWidget(
'payments.user_payments.listing.recurrent',
$this->getInstance(\Crm\AppleAppstoreModule\Components\StopRecurrentPaymentInfoWidget::class),
\Crm\AppleAppstoreModule\Components\StopRecurrentPaymentInfoWidget::class,
100
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,12 @@
namespace Crm\AppleAppstoreModule\Components;

use Crm\AppleAppstoreModule\Gateways\AppleAppstoreGateway;
use Crm\ApplicationModule\Widget\BaseWidget;
use Crm\ApplicationModule\Widget\WidgetManager;
use Crm\ApplicationModule\Widget\BaseLazyWidget;

class StopRecurrentPaymentInfoWidget extends BaseWidget
class StopRecurrentPaymentInfoWidget extends BaseLazyWidget
{
private $templateName = 'stop_recurrent_payment_info_widget.latte';


public function __construct(
WidgetManager $widgetManager
) {
parent::__construct($widgetManager);
}

public function identifier()
{
return 'stopapplerecurrentpaymentbuttonwidget';
Expand Down

0 comments on commit 6913ea1

Please sign in to comment.