Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Started adding settings not available in MTM but available via _paq #943

Open
wants to merge 11 commits into
base: 5.x-dev
Choose a base branch
from
26 changes: 13 additions & 13 deletions Template/Variable/MatomoConfigurationVariable.php
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ public function getParameters()

$field->uiControl = FieldConfig::UI_CONTROL_MULTI_TUPLE;
$field->uiControlAttributes['rows'] = 1;
$field->uiControlAttributes['showAdvancedSettings'] = 1;
$field->uiControlAttributes['showAdvancedSettings'] = 1; // This is used to hide/show this option under Advanced settings
$field1 = new FieldConfig\MultiPair('Name', 'name', FieldConfig::UI_CONTROL_TEXT);
$field1->customFieldComponent = self::FIELD_VARIABLE_COMPONENT;
$field2 = new FieldConfig\MultiPair('Value', 'value', FieldConfig::UI_CONTROL_TEXT);
Expand All @@ -457,7 +457,7 @@ public function getParameters()
$field->title = Piwik::translate('TagManager_MatomoConfigurationMatomoSetDownloadExtensionsTitle');
$field->description = Piwik::translate('TagManager_MatomoConfigurationMatomoSetDownloadExtensionsDescription');
$field->customFieldComponent = self::FIELD_VARIABLE_COMPONENT;
$field->uiControlAttributes['showAdvancedSettings'] = 1;
$field->uiControlAttributes['showAdvancedSettings'] = 1; // This is used to hide/show this option under Advanced settings
$field->transform = function ($value) {
return trim($value);
};
Expand All @@ -466,7 +466,7 @@ public function getParameters()
$field->title = Piwik::translate('TagManager_MatomoConfigurationMatomoAddDownloadExtensionsTitle');
$field->description = Piwik::translate('TagManager_MatomoConfigurationMatomoAddDownloadExtensionsDescription');
$field->customFieldComponent = self::FIELD_VARIABLE_COMPONENT;
$field->uiControlAttributes['showAdvancedSettings'] = 1;
$field->uiControlAttributes['showAdvancedSettings'] = 1; // This is used to hide/show this option under Advanced settings
$field->transform = function ($value) {
return trim($value);
};
Expand All @@ -475,7 +475,7 @@ public function getParameters()
$field->title = Piwik::translate('TagManager_MatomoConfigurationMatomoRemoveDownloadExtensionsTitle');
$field->description = Piwik::translate('TagManager_MatomoConfigurationMatomoRemoveDownloadExtensionsDescription');
$field->customFieldComponent = self::FIELD_VARIABLE_COMPONENT;
$field->uiControlAttributes['showAdvancedSettings'] = 1;
$field->uiControlAttributes['showAdvancedSettings'] = 1; // This is used to hide/show this option under Advanced settings
$field->transform = function ($value) {
return trim($value);
};
Expand All @@ -484,7 +484,7 @@ public function getParameters()
$field->title = Piwik::translate('TagManager_MatomoConfigurationMatomoSetIgnoreClassesTitle');
$field->description = Piwik::translate('TagManager_MatomoConfigurationMatomoSetIgnoreClassesDescription');
$field->customFieldComponent = self::FIELD_VARIABLE_COMPONENT;
$field->uiControlAttributes['showAdvancedSettings'] = 1;
$field->uiControlAttributes['showAdvancedSettings'] = 1; // This is used to hide/show this option under Advanced settings
$field->transform = function ($value) {
return trim($value);
};
Expand All @@ -493,7 +493,7 @@ public function getParameters()
$field->title = Piwik::translate('TagManager_MatomoConfigurationMatomoSetReferrerUrlTitle');
$field->description = Piwik::translate('TagManager_MatomoConfigurationMatomoSetReferrerUrlDescription');
$field->customFieldComponent = self::FIELD_VARIABLE_COMPONENT;
$field->uiControlAttributes['showAdvancedSettings'] = 1;
$field->uiControlAttributes['showAdvancedSettings'] = 1; // This is used to hide/show this option under Advanced settings
$field->transform = function ($value) {
return trim($value);
};
Expand All @@ -502,7 +502,7 @@ public function getParameters()
$field->title = Piwik::translate('TagManager_MatomoConfigurationMatomoSetApiUrlTitle');
$field->description = Piwik::translate('TagManager_MatomoConfigurationMatomoSetApiUrlDescription');
$field->customFieldComponent = self::FIELD_VARIABLE_COMPONENT;
$field->uiControlAttributes['showAdvancedSettings'] = 1;
$field->uiControlAttributes['showAdvancedSettings'] = 1; // This is used to hide/show this option under Advanced settings
$field->transform = function ($value) {
return trim($value);
};
Expand All @@ -511,7 +511,7 @@ public function getParameters()
$field->title = Piwik::translate('TagManager_MatomoConfigurationMatomoSetPageViewIdTitle');
$field->description = Piwik::translate('TagManager_MatomoConfigurationMatomoSetPageViewIdDescription');
$field->customFieldComponent = self::FIELD_VARIABLE_COMPONENT;
$field->uiControlAttributes['showAdvancedSettings'] = 1;
$field->uiControlAttributes['showAdvancedSettings'] = 1; // This is used to hide/show this option under Advanced settings
$field->transform = function ($value) {
return trim($value);
};
Expand All @@ -520,7 +520,7 @@ public function getParameters()
$field->title = Piwik::translate('TagManager_MatomoConfigurationMatomoSetExcludedReferrersTitle');
$field->description = Piwik::translate('TagManager_MatomoConfigurationMatomoSetExcludedReferrersDescription');
$field->customFieldComponent = self::FIELD_VARIABLE_COMPONENT;
$field->uiControlAttributes['showAdvancedSettings'] = 1;
$field->uiControlAttributes['showAdvancedSettings'] = 1; // This is used to hide/show this option under Advanced settings
$field->transform = function ($value) {
return trim($value);
};
Expand All @@ -529,7 +529,7 @@ public function getParameters()
$field->title = Piwik::translate('TagManager_MatomoConfigurationMatomoSetDownloadClassesTitle');
$field->description = Piwik::translate('TagManager_MatomoConfigurationMatomoSetDownloadClassesDescription');
$field->customFieldComponent = self::FIELD_VARIABLE_COMPONENT;
$field->uiControlAttributes['showAdvancedSettings'] = 1;
$field->uiControlAttributes['showAdvancedSettings'] = 1; // This is used to hide/show this option under Advanced settings
$field->transform = function ($value) {
return trim($value);
};
Expand All @@ -538,7 +538,7 @@ public function getParameters()
$field->title = Piwik::translate('TagManager_MatomoConfigurationMatomoSetLinkClassesTitle');
$field->description = Piwik::translate('TagManager_MatomoConfigurationMatomoSetLinkClassesDescription');
$field->customFieldComponent = self::FIELD_VARIABLE_COMPONENT;
$field->uiControlAttributes['showAdvancedSettings'] = 1;
$field->uiControlAttributes['showAdvancedSettings'] = 1; // This is used to hide/show this option under Advanced settings
$field->transform = function ($value) {
return trim($value);
};
Expand All @@ -547,7 +547,7 @@ public function getParameters()
$field->title = Piwik::translate('TagManager_MatomoConfigurationMatomoSetCampaignNameKeyTitle');
$field->description = Piwik::translate('TagManager_MatomoConfigurationMatomoSetCampaignNameKeyDescription');
$field->customFieldComponent = self::FIELD_VARIABLE_COMPONENT;
$field->uiControlAttributes['showAdvancedSettings'] = 1;
$field->uiControlAttributes['showAdvancedSettings'] = 1; // This is used to hide/show this option under Advanced settings
$field->transform = function ($value) {
return trim($value);
};
Expand All @@ -556,7 +556,7 @@ public function getParameters()
$field->title = Piwik::translate('TagManager_MatomoConfigurationMatomoSetCampaignKeywordKeyTitle');
$field->description = Piwik::translate('TagManager_MatomoConfigurationMatomoSetCampaignKeywordKeyDescription');
$field->customFieldComponent = self::FIELD_VARIABLE_COMPONENT;
$field->uiControlAttributes['showAdvancedSettings'] = 1;
$field->uiControlAttributes['showAdvancedSettings'] = 1; // This is used to hide/show this option under Advanced settings
$field->transform = function ($value) {
return trim($value);
};
Expand Down
76 changes: 76 additions & 0 deletions Updates/5.2.1.php
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Would it be safer to name it 5.2.1-b1 in case there's a beta version?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@snake14 Makes sense 👍
Done please check

Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?php

/**
* Matomo - free/libre analytics platform
*
* @link https://matomo.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/

namespace Piwik\Plugins\TagManager;

use Piwik\Plugins\TagManager\Template\Variable\MatomoConfigurationVariable;
use Piwik\Plugins\TagManager\UpdateHelper\NewVariableParameterMigrator;
use Piwik\Updater;
use Piwik\Updater\Migration\Factory as MigrationFactory;
use Piwik\Updates as PiwikUpdates;

class Updates_5_2_1 extends PiwikUpdates
{
/**
* @var MigrationFactory
*/
private $migration;

public function __construct(MigrationFactory $factory)
{
$this->migration = $factory;
}

/**
* Return database migrations to be executed in this update.
*
* Database migrations should be defined here, instead of in `doUpdate()`, since this method is used
* in the `core:update` command when displaying the queries an update will run. If you execute
* migrations directly in `doUpdate()`, they won't be displayed to the user. Migrations will be executed in the
* order as positioned in the returned array.
*
* @param Updater $updater
* @return Migration\Db[]
*/
public function getMigrations(Updater $updater)
{
return array(
);
}

/**
* Perform the incremental version update.
*
* This method should perform all updating logic. If you define queries in the `getMigrations()` method,
* you must call {@link Updater::executeMigrations()} here.
*
* @param Updater $updater
*/
public function doUpdate(Updater $updater)
{
$updater->executeMigrations(__FILE__, $this->getMigrations($updater));

// Migrate the MatomoConfiguration type variables to all include the newly configured advanced fields.
$migrator = new NewVariableParameterMigrator(MatomoConfigurationVariable::ID, 'customData', []);
$migrator->addField('setDownloadExtensions', '');
$migrator->addField('addDownloadExtensions', '');
$migrator->addField('removeDownloadExtensions', '');
$migrator->addField('setIgnoreClasses', '');
$migrator->addField('setReferrerUrl', '');
$migrator->addField('setApiUrl', '');
$migrator->addField('setPageViewId', '');
$migrator->addField('setExcludedReferrers', '');
$migrator->addField('setDownloadClasses', '');
$migrator->addField('setLinkClasses', '');
$migrator->addField('setCampaignNameKey', '');
$migrator->addField('setCampaignKeywordKey', '');
$migrator->migrate();
}
}
Loading