← All changes
|
includes/Editors/BlockEditor/Blocks/SocialShare.php
+41
-31
3.4.1
→
4.9.3
View file →
| @@ -5,42 +5,52 @@ | ||
| 5 | 5 | use WPDeveloper\BetterDocs\Editors\BlockEditor\Block; |
| 6 | 6 | use WPDeveloper\BetterDocs\Traits\SocialShare as SocialShareTrait; |
| 7 | 7 | |
| 8 | 8 | class SocialShare extends Block { |
| 9 | - use SocialShareTrait; | |
| 10 | - protected $map_view_vars = [ | |
| 11 | - 'share_title' => 'title' | |
| 12 | - ]; | |
| 9 | + use SocialShareTrait; | |
| 13 | 10 | |
| 14 | - protected $editor_styles = [ | |
| 15 | - 'betterdocs-social-share' | |
| 16 | - ]; | |
| 11 | + protected $map_view_vars = [ | |
| 12 | + 'share_title' => 'title', | |
| 13 | + 'share_title_tag' => 'title_tag' | |
| 14 | + ]; | |
| 17 | 15 | |
| 18 | - protected $frontend_styles = [ | |
| 19 | - 'betterdocs-social-share' | |
| 20 | - ]; | |
| 16 | + protected $editor_styles = [ | |
| 17 | + 'betterdocs-social-share' | |
| 18 | + ]; | |
| 21 | 19 | |
| 22 | - public function get_name() { | |
| 23 | - return 'social-share'; | |
| 24 | - } | |
| 20 | + protected $frontend_styles = [ | |
| 21 | + 'betterdocs-social-share' | |
| 22 | + ]; | |
| 25 | 23 | |
| 26 | - public function get_default_attributes() { | |
| 27 | - return [ | |
| 28 | - 'show_facebook_icon' => true, | |
| 29 | - 'show_twitter_icon' => true, | |
| 30 | - 'show_linkedin_icon' => true, | |
| 31 | - 'show_pinterest_icon' => true, | |
| 32 | - 'share_title' => __( 'Share This Article: ', 'betterdocs' ) | |
| 33 | - ]; | |
| 34 | - } | |
| 24 | + public function get_name() { | |
| 25 | + return 'social-share'; | |
| 26 | + } | |
| 35 | 27 | |
| 36 | - protected $deprecated_attributes = [ | |
| 37 | - 'show_facebook_icon' => 'facebook', | |
| 38 | - 'show_pinterest_icon' => 'pinterest', | |
| 39 | - 'show_twitter_icon' => 'twitter', | |
| 40 | - 'show_linkedin_icon' => 'linkedin' | |
| 41 | - ]; | |
| 28 | + public function get_default_attributes() { | |
| 29 | + return [ | |
| 30 | + 'show_facebook_icon' => true, | |
| 31 | + 'show_twitter_icon' => true, | |
| 32 | + 'show_linkedin_icon' => true, | |
| 33 | + 'show_pinterest_icon' => true, | |
| 34 | + 'show_instagram_icon' => true, | |
| 35 | + 'share_title' => __( 'Share This Article: ', 'betterdocs' ), | |
| 36 | + 'share_title_tag' => 'h4', | |
| 37 | + 'layout' => 'layout-1' | |
| 38 | + ]; | |
| 39 | + } | |
| 42 | 40 | |
| 43 | - public function render( $attributes, $content ) { | |
| 44 | - $this->views( 'widgets/social' ); | |
| 45 | - } | |
| 41 | + protected $deprecated_attributes = [ | |
| 42 | + 'show_facebook_icon' => 'facebook', | |
| 43 | + 'show_pinterest_icon' => 'pinterest', | |
| 44 | + 'show_twitter_icon' => 'twitter', | |
| 45 | + 'show_linkedin_icon' => 'linkedin' | |
| 46 | + ]; | |
| 47 | + | |
| 48 | + public function render( $attributes, $content ) { | |
| 49 | + $layout = $attributes['layout']; | |
| 50 | + if ( $layout == 'layout-1' ) { | |
| 51 | + $this->views( 'widgets/social' ); | |
| 52 | + } else { | |
| 53 | + $this->views( 'widgets/social-2' ); | |
| 54 | + } | |
| 55 | + } | |
| 46 | 56 | } |