PluginProbe
Elementor Website Builder – more than just a page builder / 3.30.3
Elementor Website Builder – more than just a page builder v3.30.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 / floating-buttons / classes / render / floating-bars-render-base.php

floating-bars-render-base.php in Elementor Website Builder – more than just a page builder 3.30.3, at modules/floating-buttons/classes/render/floating-bars-render-base.php

61 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Elementor\Modules\FloatingButtons\Classes\Render;
4
5 use Elementor\Modules\FloatingButtons\Base\Widget_Floating_Bars_Base;
6
7 /**
8 * Class Floating_Bars_Render_Base.
9 *
10 * This is the base class that will hold shared functionality that will be needed by all the various widget versions.
11 *
12 * @since 3.23.0
13 */
14 abstract class Floating_Bars_Render_Base {
15
16 protected Widget_Floating_Bars_Base $widget;
17
18 protected array $settings;
19
20 abstract public function render(): void;
21
22 public function __construct( Widget_Floating_Bars_Base $widget ) {
23 $this->widget = $widget;
24 $this->settings = $widget->get_settings_for_display();
25 }
26
27 protected function add_layout_render_attribute( $layout_classnames ) {
28 $this->widget->add_render_attribute( 'layout', [
29 'class' => $layout_classnames,
30 'id' => $this->settings['advanced_custom_css_id'],
31 'data-document-id' => get_the_ID(),
32 'role' => 'alertdialog',
33 ] );
34 }
35
36 public static function get_layout_classnames( Widget_Floating_Bars_Base $widget, array $settings ): string {
37 $layout_classnames = 'e-floating-bars e-' . $widget->get_name();
38 $vertical_position = $settings['advanced_vertical_position'];
39 $is_sticky = $settings['advanced_toggle_sticky'];
40 $has_close_button = $settings['floating_bar_close_switch'];
41
42 $layout_classnames .= ' has-vertical-position-' . $vertical_position;
43
44 if ( 'yes' === $has_close_button ) {
45 $layout_classnames .= ' has-close-button';
46 }
47
48 if ( 'yes' === $is_sticky ) {
49 $layout_classnames .= ' is-sticky';
50 }
51
52 return $layout_classnames;
53 }
54
55 protected function build_layout_render_attribute(): void {
56 $layout_classnames = static::get_layout_classnames( $this->widget, $this->settings );
57
58 $this->add_layout_render_attribute( $layout_classnames );
59 }
60 }
61