PluginProbe
Elementor Website Builder – more than just a page builder / 4.3.0-beta3
Elementor Website Builder – more than just a page builder v4.3.0-beta3
4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 All 452 releases
elementor / modules / atomic-widgets / elements / atomic-form / webmcp-utils.php

webmcp-utils.php in Elementor Website Builder – more than just a page builder 4.3.0-beta3, at modules/atomic-widgets/elements/atomic-form/webmcp-utils.php

47 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Elementor\Modules\AtomicWidgets\Elements\Atomic_Form;
3
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit;
6 }
7
8 class Webmcp_Utils {
9 public static function build_tool_name( string $form_name, string $element_id = '' ): string {
10 $slug = sanitize_title( $form_name );
11 $slug = str_replace( '-', '_', $slug );
12
13 if ( '' === $slug ) {
14 $slug = 'submit_form';
15 }
16
17 $id_suffix = self::build_element_id_suffix( $element_id );
18
19 if ( '' === $id_suffix ) {
20 return $slug;
21 }
22
23 return $slug . '_' . $id_suffix;
24 }
25
26 private static function build_element_id_suffix( string $element_id ): string {
27 $suffix = sanitize_title( $element_id );
28 $suffix = str_replace( '-', '_', $suffix );
29
30 return $suffix;
31 }
32
33 public static function build_tool_description( string $form_name ): string {
34 $label = trim( $form_name );
35
36 if ( '' === $label ) {
37 return esc_html__( 'Submit this form with the provided field values.', 'elementor' );
38 }
39
40 return sprintf(
41 /* translators: %s: form name */
42 esc_html__( 'Submit the %s form with the provided field values.', 'elementor' ),
43 $label
44 );
45 }
46 }
47