Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Giehl <stefan@matomo.org>2020-04-23 10:43:30 +0300
committerGitHub <noreply@github.com>2020-04-23 10:43:30 +0300
commita8d917778e75346eab9509ac9707f7e6e2e6c58d (patch)
tree8259898ab33eb882e631f1f5475cd1482f70e402 /plugins/UserCountry
parent0cdeb6da6e4679c56aa351c004cbd6afe7843c56 (diff)
Refactores the way segments are configured in dimensions (#15836)
* Improve naming of methods for segments to rescrict access for anonymous user * Introduce new classes SegmentsList nad DimensionSegmentFactory * removes SegmentEditor\SegmentList and adds some tests * submodule updates
Diffstat (limited to 'plugins/UserCountry')
-rw-r--r--plugins/UserCountry/Columns/Country.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/plugins/UserCountry/Columns/Country.php b/plugins/UserCountry/Columns/Country.php
index 139e987746..f61151a1ae 100644
--- a/plugins/UserCountry/Columns/Country.php
+++ b/plugins/UserCountry/Columns/Country.php
@@ -8,6 +8,7 @@
*/
namespace Piwik\Plugins\UserCountry\Columns;
+use Piwik\Columns\DimensionSegmentFactory;
use Piwik\Common;
use Piwik\Config;
use Piwik\Container\StaticContainer;
@@ -19,6 +20,7 @@ use Piwik\Plugin\Manager;
use Piwik\Plugin\Segment;
use Piwik\Plugins\Provider\Provider as ProviderProvider;
use Piwik\Plugins\UserCountry\LocationProvider;
+use Piwik\Segment\SegmentsList;
use Piwik\Tracker\Visit;
use Piwik\Tracker\Visitor;
use Piwik\Tracker\Action;
@@ -38,11 +40,11 @@ class Country extends Base
protected $segmentName = 'countryCode';
protected $acceptValues = 'ISO 3166-1 alpha-2 country codes (de, us, fr, in, es, etc.)';
- protected function configureSegments()
+ public function configureSegments(SegmentsList $segmentsList, DimensionSegmentFactory $dimensionSegmentFactory)
{
$segment = new Segment();
$segment->setName('UserCountry_CountryCode');
- $this->addSegment($segment);
+ $segmentsList->addSegment($dimensionSegmentFactory->createSegment($segment));
$segment = new Segment();
$segment->setSegment('countryName');
@@ -64,7 +66,7 @@ class Country extends Base
$segment->setSuggestedValuesCallback(function ($idSite, $maxValuesToReturn) use ($countryList) {
return array_values($countryList + ['Unknown']);
});
- $this->addSegment($segment);
+ $segmentsList->addSegment($dimensionSegmentFactory->createSegment($segment));
}