Issues (3627)

Integration/OneSignalIntegration.php (1 issue)

1
<?php
2
3
/*
4
 * @copyright   2014 Mautic Contributors. All rights reserved
5
 * @author      Mautic
6
 *
7
 * @link        http://mautic.org
8
 *
9
 * @license     GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
10
 */
11
12
namespace Mautic\NotificationBundle\Integration;
13
14
use Mautic\PluginBundle\Integration\AbstractIntegration;
15
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
16
use Symfony\Component\Form\Extension\Core\Type\TextType;
17
use Symfony\Component\Form\FormBuilder;
18
19
/**
20
 * Class OneSignalIntegration.
21
 */
22
class OneSignalIntegration extends AbstractIntegration
23
{
24
    /**
25
     * @var bool
26
     */
27
    protected $coreIntegration = true;
28
29
    /**
30
     * {@inheritdoc}
31
     *
32
     * @return string
33
     */
34
    public function getName()
35
    {
36
        return 'OneSignal';
37
    }
38
39
    public function getIcon()
40
    {
41
        return 'app/bundles/NotificationBundle/Assets/img/OneSignal.png';
42
    }
43
44
    public function getSupportedFeatures()
45
    {
46
        return [
47
            'mobile',
48
            'landing_page_enabled',
49
            'welcome_notification_enabled',
50
            'tracking_page_enabled',
51
        ];
52
    }
53
54
    public function getSupportedFeatureTooltips()
55
    {
56
        return [
57
            'landing_page_enabled'  => 'mautic.integration.form.features.landing_page_enabled.tooltip',
58
            'tracking_page_enabled' => 'mautic.integration.form.features.tracking_page_enabled.tooltip',
59
        ];
60
    }
61
62
    /**
63
     * {@inheritdoc}
64
     *
65
     * @return array
66
     */
67
    public function getRequiredKeyFields()
68
    {
69
        return [
70
            'app_id'        => 'mautic.notification.config.form.notification.app_id',
71
            'safari_web_id' => 'mautic.notification.config.form.notification.safari_web_id',
72
            'rest_api_key'  => 'mautic.notification.config.form.notification.rest_api_key',
73
            'gcm_sender_id' => 'mautic.notification.config.form.notification.gcm_sender_id',
74
        ];
75
    }
76
77
    /**
78
     * {@inheritdoc}
79
     *
80
     * @return string
81
     */
82
    public function getAuthenticationType()
83
    {
84
        return 'none';
85
    }
86
87
    /**
88
     * @param \Mautic\PluginBundle\Integration\Form|FormBuilder $builder
0 ignored issues
show
The type Mautic\PluginBundle\Integration\Form was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
89
     * @param array                                             $data
90
     * @param string                                            $formArea
91
     */
92
    public function appendToForm(&$builder, $data, $formArea)
93
    {
94
        if ('features' == $formArea) {
95
            /* @var FormBuilder $builder */
96
            $builder->add(
97
                'subdomain_name',
98
                TextType::class,
99
                [
100
                    'label'    => 'mautic.notification.form.subdomain_name.label',
101
                    'required' => false,
102
                    'attr'     => [
103
                        'class' => 'form-control',
104
                    ],
105
                ]
106
            );
107
108
            $builder->add(
109
                'platforms',
110
                ChoiceType::class,
111
                [
112
                    'choices' => [
113
                        'mautic.integration.form.platforms.ios'     => 'ios',
114
                        'mautic.integration.form.platforms.android' => 'android',
115
                    ],
116
                    'attr'              => [
117
                        'tooltip'      => 'mautic.integration.form.platforms.tooltip',
118
                        'data-show-on' => '{"integration_details_supportedFeatures_0":"checked"}',
119
                    ],
120
                    'expanded'    => true,
121
                    'multiple'    => true,
122
                    'label'       => 'mautic.integration.form.platforms',
123
                    'placeholder' => false,
124
                    'required'    => false,
125
                ]
126
            );
127
        }
128
    }
129
}
130