PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 3.3.1
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v3.3.1
3.3.1 V-3.3.0 3.2.2 3.2.1 3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 V3.0.3 V3.0.2 -3.0.1 V_3.0.0 1.1.1 1.1.8 1.2 1.3 1.4 1.4.18 1.5.2 1.9 2.0 2.10.0 2.10.1 All 138 releases
bit-form / includes / Core / Util / Translation / TranslationStringName.php

TranslationStringName.php in Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder 3.3.1, at includes/Core/Util/Translation/TranslationStringName.php

30 lines 809 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace BitCode\BitForm\Core\Util\Translation;
4
5 /**
6 * The single rule for turning a context key into a store-facing string name.
7 *
8 * Separate-table contexts (msg/mail/redirect) are already globally unique;
9 * form_content contexts are unique only within their form, so they carry a
10 * "-form-{id}" suffix. Every registering provider must agree on this, otherwise
11 * one form's strings land under two different names in the same store.
12 */
13 final class TranslationStringName
14 {
15 /**
16 * @param mixed $context
17 * @param mixed $formId
18 *
19 * @return string
20 */
21 public static function forForm($context, $formId)
22 {
23 $context = (string) $context;
24 if (preg_match('/^(msg|mail|redirect)-/', $context)) {
25 return $context;
26 }
27 return $context . '-form-' . (int) $formId;
28 }
29 }
30