PluginProbe
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder / 1.2.4
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder v1.2.4
6.2.14 6.2.13 6.2.12 6.2.10 6.2.11 6.2.9 6.2.8 6.2.7 6.2.6 6.2.5 6.2.4 6.2.3 6.2.2 3.6.22 3.6.31 3.6.40 3.6.41 3.6.42 3.6.50 3.6.51 3.6.60 3.6.61 3.6.62 3.6.64 3.6.65 All 196 releases
fluentform / app / Hooks / Backend.php

Backend.php in Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder 1.2.4, at app/Hooks/Backend.php

77 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Declare backend actions/filters/shortcodes
5 */
6
7 /**
8 * @var $app \FluentForm\Framework\Foundation\Application
9 */
10
11 // Add Entries Menu
12 $app->addAction('ff_fluentform_form_application_view_entries', function ($form_id) use ($app) {
13 (new \FluentForm\App\Modules\Entries\Entries())->renderEntries($form_id);
14 });
15
16 $app->addAction('fluentform_after_form_navigation_editor', function ($form_id) use ($app) {
17 (new \FluentForm\App\Modules\Registerer\Menu($app))->addPreviewButton($form_id);
18 });
19
20 $app->addAction('media_buttons', function () {
21 (new \FluentForm\App\Modules\EditorButtonModule())->addButton();
22 });
23
24 // On form submission register slack notifier
25 use FluentForm\App\Services\Slack;
26
27 $app->addAction(
28 'fluentform_submission_inserted',
29 function ($submissionId, $formData, $form) {
30 Slack::notify($submissionId, $formData, $form);
31 },
32 10, 3
33 );
34
35 // On form submission register MailChimp subscriber.
36 use FluentForm\App\Modules\Integration\MailChimpIntegration as MailChimp;
37
38 $app->addAction(
39 'fluentform_submission_inserted',
40 function ($submissionId, $formData, $form) use ($app) {
41 (new MailChimp($app))->subscribe($formData);
42 },
43 10, 3
44 );
45
46 $app->addAction('admin_init', function () {
47 (new FluentForm\App\Modules\Track\TrackModule())->initTrack();
48 });
49
50 $app->addAction('admin_notices', function () {
51 FluentForm\AdminNotice::showNotice();
52 });
53
54 /**
55 * Register events to format the field values.
56 * Response of the following elements' are
57 * typically in array format and we just
58 * need to concatenate it to a string.
59 */
60 $elements = [
61 'input_name',
62 'select',
63 'input_checkbox',
64 'input_image',
65 'input_file',
66 'input_repeat',
67 'address'
68 ];
69
70 foreach ($elements as $element) {
71 $event = 'fluentform_response_render_'.$element;
72
73 $app->addfilter($event, function ($response) {
74 return \FluentForm\App\Modules\Form\FormDataParser::formatValue($response);
75 }, 10, 1);
76 }
77