Skip to content

Commit

Permalink
Set default options on first install
Browse files Browse the repository at this point in the history
  • Loading branch information
TorbenLundsgaard committed Mar 10, 2024
1 parent 4f614d3 commit 96375e5
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Installation/Upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,18 @@ protected function v115_upgrade(): void {

Options::init()->set( $values, false, false );
}

/**
* Upgrade routine for v1.20
*/
protected function v120_upgrade(): void {

$values = [
'premium' => [
'addon_installed' => 0,
],
];

Options::init()->set( $values, false, false );
}
}
23 changes: 23 additions & 0 deletions src/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ final class Options {
'default' => '',
'constant' => 'GTMKIT_PREVIEW',
],
'datalayer_page_type' => [
'default' => true,
'type' => 'boolean',
],
],
'integrations' => [
'woocommerce_shipping_info' => [ 'default' => 1 ],
Expand All @@ -76,6 +80,9 @@ final class Options {
'type' => 'boolean',
],
],
'premium' => [
'addon_installed' => 0,
],
];

/**
Expand Down Expand Up @@ -128,6 +135,22 @@ public static function get_defaults(): array {

$map = self::$map;

if ( \is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
$map['integrations']['woocommerce_integration'] = [
'default' => true,
];
}
if ( \is_plugin_active( 'contact-form-7/wp-contact-form-7.php' ) ) {
$map['integrations']['cf7_integration'] = [
'default' => true,
];
}
if ( ( \is_plugin_active( 'easy-digital-downloads/easy-digital-downloads.php' ) || \is_plugin_active( 'easy-digital-downloads-pro/easy-digital-downloads.php' ) ) ) {
$map['integrations']['edd_integration'] = [
'default' => true,
];
}

return $map;
}

Expand Down

0 comments on commit 96375e5

Please sign in to comment.