-
Notifications
You must be signed in to change notification settings - Fork 16
/
ShariffSettingsForm.inc.php
122 lines (114 loc) · 5.86 KB
/
ShariffSettingsForm.inc.php
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<?php
/**
* @file plugins/generic/shariff/ShariffSettingsForm.inc.php
*
* Copyright (c) 2023 Universitätsbibliothek Freie Universität Berlin
* Distributed under the GNU GPL v3. For full terms see the file LICENSE.
*
* @class ShariffSettingsForm
* @ingroup plugins_generic_shariff
*
* @brief Form for managers to modify shariff plugin settings
*/
use \PKP\components\forms\FormComponent;
use \PKP\components\forms\FieldText;
use \PKP\components\forms\FieldOptions;
define('FORM_SHARIFF_SETTINGS', 'shariffSettings');
/**
* A form for implementing shariff settings.
*
* @class ShariffSettingsForm
* @brief Class implemnting ShariffSettingsForm
*/
class ShariffSettingsForm extends FormComponent {
/** @copydoc FormComponent::$id */
public $id = FORM_SHARIFF_SETTINGS;
/** @copydoc FormComponent::$method */
public $method = 'PUT';
/**
* Constructor
*
* @param string $action string URL to submit the form to
* @param array $locales array Supported locales
* @param object $context Context Journal or Press to change settings for
* @param string $baseUrl string Site's base URL. Used for image previews.
* @param string $temporaryFileApiUrl string URL to upload files to
* @param string $imageUploadUrl string The API endpoint for images uploaded through the rich text field
* @param string $publicUrl url to the frontend page
* @param array $data settings for form initialization
*/
public function __construct($action, $locales, $context) {
$this->action = $action;
$this->locales = $locales;
$this->addGroup([
'id' => 'shariffsettings',
], [])
->addField(new FieldOptions('shariffServicesSelected', [
'label' => __('plugins.generic.shariff.settings.service'),
'tooltip' => __('plugins.generic.shariff.settings.service.shared_content.note') . "<br>" . __('plugins.generic.shariff.settings.service.note'),
'description' => __('plugins.generic.shariff.settings.service.description'),
'options' => [
['value' => 'twitter', 'label' => __('plugins.generic.shariff.settings.service.twitter')],
['value' => 'facebook', 'label' => __('plugins.generic.shariff.settings.service.facebook')],
['value' => 'linkedin', 'label' => __('plugins.generic.shariff.settings.service.linkedin')],
['value' => 'pinterest', 'label' => __('plugins.generic.shariff.settings.service.pinterest')],
['value' => 'xing', 'label' => __('plugins.generic.shariff.settings.service.xing')],
['value' => 'whatsapp', 'label' => __('plugins.generic.shariff.settings.service.whatsapp')],
['value' => 'addthis', 'label' => __('plugins.generic.shariff.settings.service.addthis')],
['value' => 'tumblr', 'label' => __('plugins.generic.shariff.settings.service.tumblr')],
['value' => 'flattr', 'label' => __('plugins.generic.shariff.settings.service.flattr')],
['value' => 'diaspora', 'label' => __('plugins.generic.shariff.settings.service.diaspora')],
['value' => 'reddit', 'label' => __('plugins.generic.shariff.settings.service.reddit')],
['value' => 'stumbleupon', 'label' => __('plugins.generic.shariff.settings.service.stumbleupon')],
['value' => 'threema', 'label' => __('plugins.generic.shariff.settings.service.threema')],
['value' => 'weibo', 'label' => __('plugins.generic.shariff.settings.service.weibo')],
['value' => 'qzone', 'label' => __('plugins.generic.shariff.settings.service.qzone')],
['value' => 'mail', 'label' => __('plugins.generic.shariff.settings.service.mail')],
['value' => 'print', 'label' => __('plugins.generic.shariff.settings.service.print')],
['value' => 'buffer', 'label' => __('plugins.generic.shariff.settings.service.buffer')],
['value' => 'flipboard', 'label' => __('plugins.generic.shariff.settings.service.flipboard')],
['value' => 'tencent', 'label' => __('plugins.generic.shariff.settings.service.tencentweibo')],
['value' => 'pocket', 'label' => __('plugins.generic.shariff.settings.service.pocket')],
['value' => 'telegram', 'label' => __('plugins.generic.shariff.settings.service.telegram')],
['value' => 'vk', 'label' => __('plugins.generic.shariff.settings.service.vk')],
['value' => 'info', 'label' => __('plugins.generic.shariff.settings.service.info')]
],
'value' => $context->getData('shariffServicesSelected') ?: [],
'isOrderable' => true,
'groupId' => 'shariffsettings'
]))
->addField(new FieldOptions('shariffThemeSelected', [
'label' => __('plugins.generic.shariff.settings.theme'),
'type' => 'radio',
'options' => [
['value' => 'standard', 'label' => __('plugins.generic.shariff.settings.theme.standard')],
['value' => 'grey', 'label' => __('plugins.generic.shariff.settings.theme.grey')],
['value' => 'white', 'label' => __('plugins.generic.shariff.settings.theme.white')],
],
'value' => $context->getData('shariffThemeSelected') ?: "standard",
'groupId' => 'shariffsettings'
]))
->addField(new FieldOptions('shariffPositionSelected', [
'label' => __('plugins.generic.shariff.settings.position'),
'type' => 'radio',
'options' => [
['value' => 'submission', 'label' => __('plugins.generic.shariff.settings.position.submission')],
['value' => 'footer', 'label' => __('plugins.generic.shariff.settings.position.footer')],
['value' => 'sidebar', 'label' => __('plugins.generic.shariff.settings.position.sidebar')],
],
'value' => $context->getData('shariffPositionSelected') ?: "submission",
'groupId' => 'shariffsettings'
]))
->addField(new FieldOptions('shariffOrientationSelected', [
'label' => __('plugins.generic.shariff.settings.orientation'),
'type' => 'radio',
'options' => [
['value' => 'horizontal', 'label' => __('plugins.generic.shariff.settings.orientation.horizontal')],
['value' => 'vertical', 'label' => __('plugins.generic.shariff.settings.orientation.vertical')],
],
'value' => $context->getData('shariffOrientationSelected') ?: "horizontal",
'groupId' => 'shariffsettings'
]));
}
}
?>