PluginProbe ʕ •ᴥ•ʔ
Kubio AI Page Builder / 2.8.3
Kubio AI Page Builder v2.8.3
2.8.4 2.8.3 2.8.2 2.8.1 trunk 1.0.0 1.0.1 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.3.0 1.3.1 1.3.2 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.7.0 1.7.1 1.7.2 1.7.3 1.8.0 1.8.1 1.8.2 1.9.0 2.0.0 2.1.1 2.1.2 2.1.3 2.2.0 2.2.3 2.2.4 2.2.5 2.3.0 2.3.1 2.3.3 2.3.4 2.4.0 2.4.1 2.4.2 2.4.3 2.4.5 2.5.0 2.5.1 2.5.2 2.5.3 2.6.0 2.6.1 2.6.2 2.6.3 2.6.5 2.6.6 2.6.7 2.7.0 2.7.1 2.7.2 2.7.3 2.8.0
kubio / build / block-library / blocks / contact-form / index.php
kubio / build / block-library / blocks / contact-form Last commit date
block.json 4 years ago index.php 1 year ago
index.php
73 lines
1 <?php
2
3 namespace Kubio\Blocks;
4
5 use Kubio\Core\Blocks\BlockBase;
6 use Kubio\Core\Registry;
7 use Kubio\Core\Utils;
8
9 class ContactFormBlock extends BlockBase {
10
11 const FORM_CONTAINER = 'formContainer';
12 const FORM_WRAPPER = 'formWrapper';
13 const PLACEHOLDER = 'placeholder';
14
15
16 public function computed() {
17 $shortcode = $this->getAttribute( 'shortcode' );
18 return array(
19 'disableStyleClasses' => $this->getAttribute( 'useShortcodeStyle', false ),
20 'renderContainer' => ! ! $shortcode,
21 'renderPlaceholder' => ! $shortcode,
22 );
23 }
24
25 public function getShortcodeAttributes() {
26 return array(
27 'shortcode' => wp_kses_post( $this->getAttribute( 'shortcode' ) ),
28 'use_shortcode_style' => $this->getAttribute( 'useShortcodeStyle' ) ? 1 : 0,
29
30 'decode_data' => 0,
31 );
32 }
33
34
35 public function mapPropsToElements() {
36 $shortcode = $this->getAttribute( 'shortcode' );
37 $content = null;
38 $placeholder = null;
39 if ( $shortcode ) {
40 $content = kubio_contact_form_shortcode( $this->getShortcodeAttributes() );
41 } else {
42 $placeholder = Utils::getEmptyShortcodePlaceholder();
43 }
44
45 $containerClasses = array();
46 $useShortcodeStyle = $this->getAttribute( 'useShortcodeStyle', false );
47 if ( $useShortcodeStyle ) {
48 $containerClasses[] = 'kubio-no-style';
49 } else {
50 $containerClasses[] = 'kubio-use-style';
51 }
52 return array(
53 self::FORM_CONTAINER => array(
54 'innerHTML' => $content,
55 'className' => $containerClasses,
56 'useShortcodeStyle' => esc_attr( $useShortcodeStyle ),
57
58 ),
59 self::FORM_WRAPPER => array(
60 'useShortcodeStyle' => esc_attr( $useShortcodeStyle ),
61 ),
62 self::PLACEHOLDER => array(
63 'innerHTML' => $placeholder,
64 ),
65 );
66 }
67 }
68
69 Registry::registerBlock(
70 __DIR__,
71 ContactFormBlock::class
72 );
73