PluginProbe
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News / 4.0.7
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News v4.0.7
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 2.3.5 2.3.6 2.4.0 2.4.1 2.4.10 2.4.11 2.4.12 2.4.13 2.4.14 2.4.15 2.4.16 2.4.17 2.4.18 2.4.19 2.4.2 2.4.20 2.4.21 All 88 releases
post-carousel / blocks / includes / social-profiles / Social_Profiles.php

Social_Profiles.php in Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News 4.0.7, at blocks/includes/social-profiles/Social_Profiles.php

86 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Social profiles class for Smart Post Show Blocks.
4 *
5 * @package Smart_Post_Show_Pro
6 * @subpackage Smart_Post_Show_Pro/blocks/includes
7 */
8
9 namespace SmartPostShow\Blocks;
10
11 use SmartPostShow\Blocks\Helper;
12
13 use SmartPostShow\Blocks\Block_Base;
14
15 if ( ! defined( 'ABSPATH' ) ) {
16 exit;
17 }
18
19 /**
20 * Social Profile Item Block Class.
21 */
22 class Social_Profiles extends Block_Base {
23
24
25 /**
26 * Set_block_properties
27 *
28 * @return void
29 */
30 protected function set_block_properties() {
31 $this->block_name = 'social-profiles';
32 $this->styles = array( 'sp_smart_post_blocks_google_fonts' );
33 }
34
35 /**
36 * Render Social Profile Item block.
37 *
38 * @param array $attributes Block attributes.
39 * @param string $content Block content.
40 * @param array $blocks Inner blocks.
41 * @return $content.
42 */
43 public function render_block( $attributes, $content = '', $blocks = array() ) {
44 if ( Helper::is_editor_page() ) {
45 return $content;
46 }
47
48 $attributes['page_id'] = get_the_ID();
49 $sp_block_name = $attributes['blockName'] ?? '';
50 $sp_unique_id = $attributes['uniqueId'] ?? '';
51 $sp_layout = $attributes['layout'] ?? '';
52 $sp_social_alignment = $attributes['socialAlignment'] ?? '';
53 $sp_social_hover_effect = $attributes['socialHoverEffect'] ?? '';
54 $additional_css_class = $attributes['additionalCssClass'] ?? '';
55 $show_divider_icon = ! empty( $attributes['socialIconDivider'] ) ? $attributes['socialIconDivider'] : false;
56
57 unset(
58 $attributes['dynamicCss'],
59 $attributes['fontListsEditPage'],
60 $attributes['fontLists']
61 );
62
63 // const dividerClass =
64 // layout === "social-profiles-layout-three" && socialIconDivider ? "sp-icon-divider" : "sp-icon-divider-none";
65 $divider_class = ( 'social-profiles-layout-three' === $sp_layout && $show_divider_icon ) ? 'sp-icon-divider' : 'sp-icon-divider-none';
66
67 $sp_profiles_wrapper_class = 'sp-social-profile-wrapper ' . $sp_layout . ' sp-align-' . $sp_social_alignment . ' sp-icon-hover-effect-' . $sp_social_hover_effect . ' ' . $divider_class;
68 $align_class = isset( $attributes['align'] ) ? 'align' . $attributes['align'] : '';
69 $container_class = 'sp-smart-post-wrapper' . $align_class . ( $additional_css_class === '' ? '' : ' ' . $additional_css_class );
70
71 ob_start();
72 ?>
73 <div class="<?php echo esc_attr( $container_class ); ?>">
74 <div id="<?php echo esc_attr( $sp_unique_id ); ?>" class="sp-smart-post-wrapper">
75 <div class="<?php echo esc_attr( $sp_profiles_wrapper_class ); ?>">
76 <div class="sp-social-profile-wrapper-grid-class">
77 <?php echo wp_kses_post( $content ); ?>
78 </div>
79 </div>
80 </div>
81 </div>
82 <?php
83 return ob_get_clean();
84 }
85 }
86