-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSystemSettings.php
More file actions
40 lines (34 loc) · 1.4 KB
/
SystemSettings.php
File metadata and controls
40 lines (34 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
/**
* Matomo - free/libre analytics platform
*
* @link https://matomo.org
* @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
namespace Piwik\Plugins\Slack;
use Piwik\Piwik;
use Piwik\Settings\Setting;
use Piwik\Settings\FieldConfig;
use Piwik\Url;
class SystemSettings extends \Piwik\Settings\Plugin\SystemSettings
{
/** @var Setting */
public $slackOauthToken;
protected function init()
{
// System setting --> allows selection of a single value
$this->slackOauthToken = $this->createSlackOauthTokenSetting();
}
private function createSlackOauthTokenSetting()
{
return $this->makeSetting('slackOauthToken', $default = '', FieldConfig::TYPE_STRING, function (FieldConfig $field) {
$field->title = Piwik::translate('Slack_OauthTokenSettingTitle');
$field->uiControl = FieldConfig::UI_CONTROL_PASSWORD;
$link = Url::addCampaignParametersToMatomoLink('https://matomo.org/faq/reports/how-to-get-the-slack-oauth-token-for-matomo-integration/', null, null, 'App.SystemSettings.Slack') . '#step-1-get-a-slack-oauth-token';
$field->inlineHelp = Piwik::translate('Slack_OauthTokenSettingDescription', ['<a href="' . $link . '" target="_blank" rel="noreferrer noopener">', '</a>']);
$field->transform = function ($value) {
return trim($value);
};
});
}
}