PluginProbe
Block Animations, Motion & Scroll Effects – Ghost Kit / 3.4.1
Block Animations, Motion & Scroll Effects – Ghost Kit v3.4.1
3.7.2 3.7.1 3.7.0 3.6.1 trunk 1.6.3 2.25.0 3.3.0 3.3.1 3.3.2 3.3.3 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.5.0 3.5.1 3.6.0
ghostkit / gutenberg / blocks / form / fields / url / block.php

block.php in Block Animations, Motion & Scroll Effects – Ghost Kit 3.4.1, at gutenberg/blocks/form/fields/url/block.php

74 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Form Field Url block.
4 *
5 * @package ghostkit
6 */
7
8 if ( ! defined( 'ABSPATH' ) ) {
9 exit;
10 }
11
12 /**
13 * Class GhostKit_Form_Field_Url_Block
14 */
15 class GhostKit_Form_Field_Url_Block {
16 /**
17 * GhostKit_Form_Field_Url_Block constructor.
18 */
19 public function __construct() {
20 add_action( 'init', array( $this, 'init' ) );
21 }
22
23 /**
24 * Init.
25 */
26 public function init() {
27 register_block_type_from_metadata(
28 dirname( __FILE__ ),
29 array(
30 'render_callback' => array( $this, 'block_render' ),
31 'attributes' => GhostKit_Form_Field_Attributes::get_block_attributes(
32 array(
33 'label' => array(
34 'default' => esc_html__( 'URL', 'ghostkit' ),
35 ),
36 )
37 ),
38 )
39 );
40 }
41
42 /**
43 * Register gutenberg block output
44 *
45 * @param array $attributes - block attributes.
46 *
47 * @return string
48 */
49 public function block_render( $attributes ) {
50 ob_start();
51
52 $class = 'ghostkit-form-field ghostkit-form-field-url';
53
54 if ( isset( $attributes['className'] ) ) {
55 $class .= ' ' . $attributes['className'];
56 }
57
58 ?>
59
60 <div class="<?php echo esc_attr( $class ); ?>">
61 <?php GhostKit_Form_Field_Label::get( $attributes ); ?>
62
63 <input type="url" <?php GhostKit_Form_Field_Attributes::get( $attributes ); ?> />
64
65 <?php GhostKit_Form_Field_Description::get( $attributes ); ?>
66 </div>
67
68 <?php
69
70 return ob_get_clean();
71 }
72 }
73 new GhostKit_Form_Field_Url_Block();
74