Issues (3627)

SmsBundle/Integration/TwilioIntegration.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\SmsBundle\Integration;
13
14
use Mautic\CoreBundle\Form\Type\YesNoButtonGroupType;
15
use Mautic\PluginBundle\Integration\AbstractIntegration;
16
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
17
use Symfony\Component\Form\Extension\Core\Type\NumberType;
18
use Symfony\Component\Form\Extension\Core\Type\TextType;
19
20
/**
21
 * Class TwilioIntegration.
22
 */
23
class TwilioIntegration extends AbstractIntegration
24
{
25
    /**
26
     * @var bool
27
     */
28
    protected $coreIntegration = true;
29
30
    /**
31
     * {@inheritdoc}
32
     *
33
     * @return string
34
     */
35
    public function getName()
36
    {
37
        return 'Twilio';
38
    }
39
40
    public function getIcon()
41
    {
42
        return 'app/bundles/SmsBundle/Assets/img/Twilio.png';
43
    }
44
45
    public function getSecretKeys()
46
    {
47
        return ['password'];
48
    }
49
50
    /**
51
     * {@inheritdoc}
52
     *
53
     * @return array
54
     */
55
    public function getRequiredKeyFields()
56
    {
57
        return [
58
            'username' => 'mautic.sms.config.form.sms.username',
59
            'password' => 'mautic.sms.config.form.sms.password',
60
        ];
61
    }
62
63
    /**
64
     * {@inheritdoc}
65
     *
66
     * @return string
67
     */
68
    public function getAuthenticationType()
69
    {
70
        return 'none';
71
    }
72
73
    /**
74
     * @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...
75
     * @param array                                             $data
76
     * @param string                                            $formArea
77
     */
78
    public function appendToForm(&$builder, $data, $formArea)
79
    {
80
        if ('features' == $formArea) {
81
            $builder->add(
82
                'sending_phone_number',
83
                TextType::class,
84
                [
85
                    'label'      => 'mautic.sms.config.form.sms.sending_phone_number',
86
                    'label_attr' => ['class' => 'control-label'],
87
                    'required'   => false,
88
                    'attr'       => [
89
                        'class'   => 'form-control',
90
                        'tooltip' => 'mautic.sms.config.form.sms.sending_phone_number.tooltip',
91
                    ],
92
                ]
93
            );
94
            $builder->add(
95
                'disable_trackable_urls',
96
                YesNoButtonGroupType::class,
97
                [
98
                    'label' => 'mautic.sms.config.form.sms.disable_trackable_urls',
99
                    'attr'  => [
100
                        'tooltip' => 'mautic.sms.config.form.sms.disable_trackable_urls.tooltip',
101
                    ],
102
                    'data'=> !empty($data['disable_trackable_urls']) ? true : false,
103
                ]
104
            );
105
            $builder->add('frequency_number', NumberType::class,
106
                [
107
                    'scale'      => 0,
108
                    'label'      => 'mautic.sms.list.frequency.number',
109
                    'label_attr' => ['class' => 'control-label'],
110
                    'required'   => false,
111
                    'attr'       => [
112
                        'class' => 'form-control frequency',
113
                    ],
114
                ]);
115
            $builder->add('frequency_time', ChoiceType::class,
116
                [
117
                    'choices' => [
118
                        'day'   => 'DAY',
119
                        'week'  => 'WEEK',
120
                        'month' => 'MONTH',
121
                    ],
122
                    'label'             => 'mautic.lead.list.frequency.times',
123
                    'label_attr'        => ['class' => 'control-label'],
124
                    'required'          => false,
125
                    'multiple'          => false,
126
                    'attr'              => [
127
                        'class' => 'form-control frequency',
128
                    ],
129
                ]);
130
        }
131
    }
132
}
133