Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F1349478
TYPProfileShareBlock.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Subscribers
None
TYPProfileShareBlock.php
View Options
<?php
/**
* @file
* Contains \Drupal\search\Plugin\Block\SearchBlock.
*/
namespace
Drupal\typ_profile\Plugin\Block
;
use
Drupal\Core\Block\BlockBase
;
use
Drupal\Core\Url
;
use
Drupal\typ_legacy\Service\TYPLegacyLandingPageService
;
use
Drupal\typ_search\Service\TYPSearchService
;
use
Drupal\typ_legacy\Serivee
;
/**
* Provides a 'Search form' block.
*
* @Block(
* id = "typ_profile_share_block",
* admin_label = @Translation("Profile Share"),
* category = @Translation("TYP")
* )
*/
class
TYPProfileShareBlock
extends
BlockBase
{
protected
$data
;
protected
$result
;
public
function
build
(){
$fullurl
=
'http://'
.
$_SERVER
[
HTTP_HOST
].
$_SERVER
[
'REQUEST_URI'
];
$url
=
\Drupal
::
request
()->
getRequestUri
();
$language
=
\Drupal
::
languageManager
()->
getCurrentLanguage
()->
getId
();
$bid
=
end
(
explode
(
"/"
,
$url
));
$this
->
data
=
\Drupal
::
service
(
"typ.search"
)->
getProfile
(
$bid
,
AUTO
);
$this
->
result
=
\Drupal
::
service
(
'typ.unvservice'
)->
loadListing
(
$this
->
data
[
'customerid'
],
NULL
);
$type
=
$this
->
result
[
'address'
][
$this
->
data
[
'headingcode'
]][
$this
->
data
[
'addressid'
]][
'customertype'
];
switch
(
$type
){
case
"FL"
:
$email
=
'mailto:email@address.com?subject='
.
format_string
(
$this
->
data
[
'humanname'
]).
'&body=Link:'
.
format_string
(
$fullurl
).
format_string
(
$this
->
data
[
'proddesc'
]);
$facebook
=
'https://www.facebook.com/sharer/sharer.php?u='
.
$fullurl
;
$twitter
=
$fullurl
;
$gplus
=
'https://plus.google.com/share?url='
.
$fullurl
;
break
;
default
:
$email
=
'mailto:email@address.com?subject='
.
format_string
(
$this
->
data
[
'humanname'
]).
'&body=Link:'
.
format_string
(
$fullurl
).
format_string
(
$this
->
data
[
'proddesc'
]);
$facebook
=
'https://www.facebook.com/sharer/sharer.php?u='
.
$fullurl
;
$twitter
=
$fullurl
;
$gplus
=
'https://plus.google.com/share?url='
.
$fullurl
;
}
$base_url_images
=
'/themes/bootstrap/typ/images/icon-service-profilepage/'
.
$language
;
$build
=
array
();
$build
[]
=
array
(
'#markup'
=>
format_string
(
'<div class="col-xs-12 col-md-12 col-lg-12 form-inline text-center profile_share">
<div class="col-xs-4 col-sm-5 col-md-4 col-lg-4" >
<a href="'
.
$email
.
'"><img class="profile_email" onmouseover="hover_share(this);" onmouseout="out_share(this);" src="'
.
$base_url_images
.
'/pf-icon-email1-'
.
$language
.
'.png"></a>
</div>
<div class="col-xs-4 col-sm-5 col-md-4 col-lg-4" >
<a href="http://promotion.yellowpages.co.th/" TARGET="_blank" ><img class="profile_promotion" onmouseover="hover_share(this);" onmouseout="out_share(this);" src="'
.
$base_url_images
.
'/pf-icon-promation1-'
.
$language
.
'.png"></a>
</div>
<div class="col-xs-4 col-sm-5 col-md-4 col-lg-4" >
<a href="#" onclick="print_content()"><img class="profile_print" onmouseover="hover_share(this);" onmouseout="out_share(this);" src="'
.
$base_url_images
.
'/pf-icon-print1-'
.
$language
.
'.png"></a>
</div>
<div class="col-xs-4 col-sm-5 col-md-4 col-lg-4" >
<a href="#" onclick="window.open(
\'
'
.
$facebook
.
'
\'
,
\'
name
\'
,
\'
width=600,height=400
\'
)" ><img class="profile_facebook" onmouseover="hover_share(this);" onmouseout="out_share(this);" src="'
.
$base_url_images
.
'/pf-icon-facebook1-'
.
$language
.
'.png"></a>
</div>
<div class="col-xs-4 col-sm-5 col-md-4 col-lg-4" >
<a href="#" data-url="'
.
$twitter
.
'" data-text="'
.
$this
->
data
[
'humanname'
].
'" onclick="window.open(
\'
https://twitter.com/share
\'
,
\'
name
\'
,
\'
width=600,height=400
\'
)" ><img class="profile_twitter" onmouseover="hover_share(this);" onmouseout="out_share(this);" src="'
.
$base_url_images
.
'/pf-icon-twitter+1-'
.
$language
.
'.png"></a>
</div>
<div class="col-xs-4 col-sm-5 col-md-4 col-lg-4" >
<a href="" onclick="window.open(
\'
'
.
$gplus
.
'
\'
,
\'
name
\'
,
\'
width=600,height=400
\'
)" ><img class="profile_google" onmouseover="hover_share(this);" onmouseout="out_share(this);" src="'
.
$base_url_images
.
'/pf-icon-google+1-'
.
$language
.
'.png"></a>
</div>
</div>'
),
);
$build
[
'#attached'
][
'library'
]
=
array
(
'typ_profile/profile_share'
);
return
$build
;
}
}
?>
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Sep 9, 5:16 AM (1 d, 23 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
237408
Attached To
rPF typ_profile
Event Timeline
Log In to Comment