update with latest changes and DE translations

This commit is contained in:
2022-01-16 20:10:06 +01:00
parent e583fc62dd
commit ee351b44b1
10 changed files with 928 additions and 150 deletions

View File

@@ -0,0 +1,35 @@
<?php namespace NicoSt\GCalendar\FormWidgets;
use Backend\Classes\FormWidgetBase;
use Cache;
use Log;
use Flash;
use Lang;
use NicoSt\GCalendar\Models\Settings;
class ClearCacheButton extends FormWidgetBase {
protected $defaultAlias = 'clearCacheButton';
private $cacheKeyCalendarList = 'GCalendar-CalendarList';
private $cacheKeyCalendarGet = 'GCalendar-CalendarGet#';
public function render() {
return $this->makePartial('clearCacheButton');
}
// Clear cache for all saved calendars
public function onClearCache() {
$calendarSelectors = Settings::get('calendar_selector', []);
foreach ($calendarSelectors as &$selector) {
Cache::forget($this->cacheKeyCalendarGet.$selector['id']);
}
Cache::forget($this->cacheKeyCalendarList);
Log::info('G-Calendar: Cache cleared!');
Flash::success(Lang::get('nicost.gcalendar::lang.widget.clearCacheButton.success'));
}
}