| 1 |
<?php |
| 2 |
|
| 3 |
namespace WPDeveloper\BetterDocs\Editors\BlockEditor\Blocks; |
| 4 |
|
| 5 |
use WPDeveloper\BetterDocs\Editors\BlockEditor\Block; |
| 6 |
use WPDeveloper\BetterDocs\Traits\SocialShare as SocialShareTrait; |
| 7 |
|
| 8 |
class SocialShare extends Block { |
| 9 |
use SocialShareTrait; |
| 10 |
|
| 11 |
protected $map_view_vars = [ |
| 12 |
'share_title' => 'title', |
| 13 |
'share_title_tag' => 'title_tag' |
| 14 |
]; |
| 15 |
|
| 16 |
protected $editor_styles = [ |
| 17 |
'betterdocs-social-share' |
| 18 |
]; |
| 19 |
|
| 20 |
protected $frontend_styles = [ |
| 21 |
'betterdocs-social-share' |
| 22 |
]; |
| 23 |
|
| 24 |
public function get_name() { |
| 25 |
return 'social-share'; |
| 26 |
} |
| 27 |
|
| 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 |
} |
| 40 |
|
| 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 |
} |
| 56 |
} |
| 57 |
|