Plugin toggle widget

Kirby - Plugins widget

Version 1.0.0 - 2016-08-03

  • Initial Public Offering…

What is it?

Kirby - Plugins widget, is a simple widget for the Kirby CMS.

It shows all plugins used in your site with the option to toggle their status (on / off).

More info about Kirby can be found at http://getkirby.com

##Installation##

  • Download the .zip and place the plugins folder (located in site\widgets) in your own widgets folder.
  • Copy / paste the settings from site\config\config_example.php in your own config\config.php file *).

*) note - at default these settings are correct.

If you need to change the default path of your plugins-folder, you can change the plugins-widget setting in this file.


Version 1.0.0

2 Likes

Looks really nice! But where is it? :smiley:

Feedback

Add something to show that the enable/disable was finished / successful, like make the icon green for 3 seconds or so.

It’s… on my local machine only :slight_smile:

Will finish it and than share it with the community!

About your feedback; I’m not sure what you mean - but the widget works like this;

  1. An active plugin is black and shows the ‘on’ toggle.
  2. An in-active (disabled) plugin is gray and shows the ‘off’ toggle.

When something went wrong, the toggle / color doesn’t change and a popup is shown with the error-message.

So I guess that’s enough ‘visual’ information for a user?

1 Like

Ok then it’s fine. I thought the switch was switched and then after that the ajax was called to make the plugin activate/deactivate. But in this case, if it flips, it have succeded. :slight_smile:

Yes;

on-success = flip toggle (active to inactive, inactive to active).

on-error = nothing changes, error-msg is thrown


It’s a simple widget; it just reads out all plugins in the plugin directory and the toggle renames the directory with a _ in front of it (so it becomes inactive).

plugins/minifyhtml = working plugin

plugins/_minifyhtml = disabled plugin

It can come in handy while developing to toggle the plugins (well, I stole it from Wordpress…).

1 Like

I have moved this to its own topic because it’s a bit off-topic. Once the plugin is published, feel free to edit the first post to contain the details.

1 Like

Very similar to my plugin:

https://github.com/jenstornell/kirby-unset-plugins

Yours is controlled by the panel and mine from the config file. I used a dot as prefix.

I’ve never used my plugin since I wrote it so that was kind of stupid thing to do. No one else seems to have installed it either. :confused:

Your plugin is probably of better use. Will be interesting to try and see if it feels useful. :slight_smile:

I see the plugin widget as an extension to my at a glance widget.

Both show basic / similar information about the status of your site.

It would be nice when the plugin widget could show more information (about the author, versionnumber, supporting website, etc…).

Kirby - At a Glance [widget]

The most simple way is probably to read package.json to extract that information. It’s now included in many plugins. It’s ment to be used by the Kirby CLI but it could be perfect for this case as well.

2 Likes

Is the package.json format / syntax documented anywhere?

I can’t find it, using the search on this site.

Also, there seems to be an alternative to both your and mine widget, but it seems out of order (404 on Git).

Well, my widget is finished almost and will update it with the package.json metadata later on.

Yes, but it checked with the Git repo for updates if I remember correctly. @distantnative

It was not ment to disable them with the panel with that plugin.

Well, it’s live now :slight_smile:

https://github.com/1n3JgKl9pQ6cUMrW/kirby-plugins-widget/

I didn’t like the idea of filling up the config.php with lot’s of code (I don’t think it belongs there…).

So I did a file-include in config.php

c::set('plugins-widget', 'site/widgets/plugins/');

if (file_exists(c::get('plugins-widget') . 'widgets.php' )) {
  include_once(c::get('plugins-widget') . 'widgets.php');
}
1 Like

Looks great (screenshot, have not tested)! Will probably use it for one of my projects. :slight_smile:

I looked into the code and I think you would benefit from register the widget and other stuff as a plugin. It’s not that hard to learn.

https://getkirby.com/docs/developer-guide/plugins/registry

From the docs:

// The directory must exist and it must have a PHP file with the same name in it
$kirby->set('widget', 'mywidget', __DIR__ . '/widgets/mywidget');
1 Like

+1 - And making it possible to use as a submodule. Please :heart_eyes_cat:

Will figure this out… when back from vacation :slight_smile: