License dialog: plugin context

I’m trying to create a unified license dialog for multiple plugins in the panel and I’m looking for ways to pass information to said dialog.

Referencing the dialog via the LicenseStatus class is easy;

new LicenseStatus(
    value: 'missing',
    theme: 'negative',
    label: t('hananils.license.test'),
    icon: 'alert',
    dialog: 'hananils/activate'
);

My question is: How do I pass data to the dialog’s load function? Or – if that’s not possible – how do I access content information from within the load function?

As an example: The most basic information I’m looking for is the name of the plugin the license dialog was called for. Does Kirby pass a $plugin object to the dialogs?

It seems like it’s possible to pass information via GET attributes:

new LicenseStatus(
	value: 'missing',
	theme: 'negative',
	label: t('hananils.license.evaluation'),
	icon: 'alert',
	dialog: 'hananils/activate?name=License Manager'
);

So in the dialog functions this is available via get('name'). Maybe not the most elegant way, but it works.

Would’ve been my suggestion as well, I think for basic information/data that’s the most straightforward.

1 Like