PluginProbe
Elementor Website Builder – more than just a page builder / 3.32.3
Elementor Website Builder – more than just a page builder v3.32.3
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 4.0.7 All 451 releases
elementor / modules / components / widgets / component.php

component.php in Elementor Website Builder – more than just a page builder 3.32.3, at modules/components/widgets/component.php

68 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Elementor\Modules\Components\Widgets;
3
4 use Elementor\Modules\AtomicWidgets\Elements\Atomic_Widget_Base;
5 use Elementor\Modules\AtomicWidgets\PropTypes\Primitives\Number_Prop_Type;
6 use Elementor\Plugin;
7
8 if ( ! defined( 'ABSPATH' ) ) {
9 exit; // Exit if accessed directly.
10 }
11
12 class Component extends Atomic_Widget_Base {
13
14 public static function get_element_type(): string {
15 return 'e-component';
16 }
17
18 public function show_in_panel() {
19 return false;
20 }
21
22 public function get_title() {
23 $title = esc_html__( 'Component', 'elementor' );
24
25 if ( isset( $this->get_settings ) && null !== $this->get_settings( 'component_id' ) ) {
26 $post_id = $this->get_settings( 'component_id' )['value'];
27 $title = Plugin::$instance->documents->get( $post_id )->get_title();
28 }
29
30 return $title;
31 }
32
33 public function get_keywords() {
34 return [ 'component' ];
35 }
36
37 public function get_icon() {
38 return 'eicon-star';
39 }
40
41 protected static function define_props_schema(): array {
42 return [
43 'component_id' => Number_Prop_Type::make(),
44 ];
45 }
46
47 protected function define_atomic_controls(): array {
48 return [];
49 }
50
51 protected function get_settings_controls(): array {
52 return [];
53 }
54
55 protected function render(): void {
56 if ( null === $this->get_settings( 'component_id' ) ) {
57 return;
58 }
59
60 $post_id = $this->get_settings( 'component_id' )['value'];
61 $content = Plugin::$instance->frontend->get_builder_content( $post_id );
62 $html = sprintf( '<div class="e-component">%s</div>', $content );
63
64 // PHPCS - should not be escaped.
65 echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
66 }
67 }
68