Skip to content

Commit

Permalink
Campaign export settings fix
Browse files Browse the repository at this point in the history
  • Loading branch information
spitfire305 committed Apr 26, 2024
1 parent d32a12f commit bda5b1d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
9 changes: 0 additions & 9 deletions app/Models/Campaign.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,6 @@ public function enabled(string $module): bool
return (bool) CampaignCache::settings()->get($module);
}

/**
* Determine if a campaign has a module enabled or not
*
*/
public function modules()
{
return CampaignCache::settings();
}

/**
* Get the is public attribute for forms
*/
Expand Down
19 changes: 14 additions & 5 deletions app/Services/Campaign/ExportService.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
use App\Facades\Module;
use Zip;

class ExportService
Expand Down Expand Up @@ -119,12 +118,22 @@ public function filesize(): int
protected function campaignModules(): self
{
$modules = [];
foreach ($this->campaign->modules() as $name => $active) {
$settings = $this->campaign->setting->toArray();
unset($settings['id'], $settings['campaign_id'], $settings['created_at'], $settings['updated_at']);
$entities = config('entities.ids');

foreach ($settings as $name => $active) {
$module = ['enabled' => $active];
if (!in_array($name, ['dice_rolls', 'conversations', 'bookmarks', 'inventories', 'entity_attributes', 'assets'])) {
$module['name_singular'] = Module::campaign($this->campaign)->singular($name);
$module['name_plural'] = Module::campaign($this->campaign)->plural($name);
$module['icon'] = Module::campaign($this->campaign)->icon($name);
if ($this->campaign->hasModuleName($entities[Str::singular($name)])) {
$module['name_singular'] = $this->campaign->moduleName($entities[Str::singular($name)]);
}
if ($this->campaign->hasModuleName($entities[Str::singular($name)], true)) {
$module['name_plural'] = $this->campaign->moduleName($entities[Str::singular($name)], true);
}
if ($this->campaign->hasModuleIcon($entities[Str::singular($name)])) {
$module['icon'] = $this->campaign->moduleIcon($entities[Str::singular($name)]);
}
}

$modules[$name] = $module;
Expand Down

0 comments on commit bda5b1d

Please sign in to comment.