PluginProbe
SureForms – Contact Form Builder, AI Forms, Payment Form, Survey & Quiz / 2.12.8
SureForms – Contact Form Builder, AI Forms, Payment Form, Survey & Quiz v2.12.8
2.12.8 2.12.7 2.12.6 2.12.5 2.12.4 2.12.3 2.12.2 2.12.1 2.12.0 2.11.1 2.11.0 2.10.1 2.10.0 2.9.1 2.9.0 2.8.2 2.8.1 2.7.0 2.7.1 2.8.0 trunk 0.0.10 0.0.11 0.0.12 0.0.13 All 98 releases
← All changes | inc/blocks/base.php +2 -67 0.0.11 → 2.12.8 View file →
@@ -26,16 +26,8 @@
26 26 */
27 27 protected $directory = '';
28 28
29 29 /**
30 - * Holds the block.
31 - *
32 - * @var object
33 - * @since 0.0.1
34 - */
35 - protected $block;
36 -
37 - /**
38 30 * Register the block for dynamic output
39 31 *
40 32 * @return void
41 33 * @since 0.0.1
@@ -40,14 +32,13 @@
40 32 * @return void
41 33 * @since 0.0.1
42 34 */
43 35 public function register() {
44 - $dir = $this->get_dir();
45 36 register_block_type_from_metadata(
46 37 $this->get_dir(),
47 38 apply_filters(
48 39 'srfm_block_registration_args',
49 - [ 'render_callback' => [ $this, 'pre_render' ] ]
40 + [ 'render_callback' => [ $this, 'render' ] ]
50 41 )
51 42 );
52 43 }
53 44
@@ -66,72 +57,16 @@
66 57 $fn = (string) $reflector->getFileName();
67 58 return dirname( $fn );
68 59 }
69 60
70 -
71 61 /**
72 - * Optionally run a function to modify attributes before rendering.
73 - *
74 - * @param array<mixed> $attributes Block attributes.
75 - * @param string $content Post content.
76 - * @param array<mixed> $block Block attributes.
77 - *
78 - * @return boolean|string
79 - * @since 0.0.1
80 - */
81 - public function pre_render( $attributes, $content, $block ) {
82 - $this->block = (object) $block;
83 -
84 - // run middlware.
85 - $render = $this->middleware( $attributes, $content );
86 -
87 - if ( is_wp_error( $render ) ) {
88 - return $render->get_error_message();
89 - }
90 -
91 - if ( true !== $render ) {
92 - return $render;
93 - }
94 -
95 - /** $attributes = $this->getAttributes( $attributes ); */
96 -
97 - // render.
98 - return $this->render( $attributes, $content );
99 - }
100 -
101 - /**
102 - * Run any block middleware before rendering.
103 - *
104 - * @param array<mixed> $attributes Block attributes.
105 - * @param string $content Post content.
106 - * @return boolean|\WP_Error;
107 - * @since 0.0.1
108 - */
109 - protected function middleware( $attributes, $content ) {
110 - return true;
111 - }
112 -
113 - /**
114 - * Allows filtering of attributes before rendering.
115 - *
116 - * @param array<mixed> $attributes Block attributes.
117 - * @return array<mixed> $attributes
118 - * @since 0.0.1
119 - */
120 - public function get_attributes( $attributes ) {
121 - return $attributes;
122 - }
123 -
124 - /**
125 62 * Render the block
126 63 *
127 64 * @param array<mixed> $attributes Block attributes.
128 - * @param string $content Post content.
129 65 *
130 66 * @return string
131 67 * @since 0.0.1
132 68 */
133 - public function render( $attributes, $content ) {
69 + public function render( $attributes ) {
134 70 return '';
135 -
136 71 }
137 72 }