Page MenuHomePhabricator

TYPProfileFacebook.php
No OneTemporary

TYPProfileFacebook.php

<?php
namespace Drupal\typ_profile\Plugin\Block;
/**
* @file
* Contains \Drupal\search\Plugin\Block\SearchBlock.
*/
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_facebook",
* admin_label = @Translation("Profile facebook"),
* category = @Translation("TYP")
* )
*/
class TYPProfileFacebook extends BlockBase
{
protected $data;
protected $result;
public function getCacheMaxAge() {
return 0; // NOCACHE!
}
public function build(){
$url = \Drupal::request()->getRequestUri();
$s = explode("/",$url);
$bid = end($s);
$this->data = \Drupal::service("typ.search")->getProfile($bid ,AUTO);
$this->result = \Drupal::service('typ.unvservice')->loadListing($this->data['customerid'],NULL);
$facebook = '';
if($this->data['customertype'] == 'FL' || $this->data['customertype'] == '' || $this->result['accounting_status'] == '1' || $this->data['hide'] == '1' || $this->data['accounting_status'] == '1'){
$facebook = format_string('<div class="text-center"><div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/th_TH/sdk.js#xfbml=1&version=v2.4";
fjs.parentNode.insertBefore(js, fjs);
}(document, \'script\', \'facebook-jssdk\'));</script>
<div class="fb-page" data-href="https://www.facebook.com/ThailandYellowPages" data-width="350" data-small-header="false" data-adapt-container-width="true" data-hide-cover="false" data-show-facepile="true" data-show-posts="false"><div class="fb-xfbml-parse-ignore"><blockquote cite="https://www.facebook.com/ThailandYellowPages"><a href="https://www.facebook.com/ThailandYellowPages">Thailand YellowPages</a></blockquote></div></div></div>', array());
}
$build = array();
$build[] = array(
'#markup' => $facebook,
);
return $build;
}
}

File Metadata

Mime Type
text/x-php
Expires
Wed, Dec 25, 4:00 AM (1 d, 10 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
193880

Event Timeline