GoogleScholar.php in Bibliography & Citation 2.0.x
File
modules/bibcite_entity/src/Plugin/bibcite/link/GoogleScholar.php
View source
<?php
namespace Drupal\bibcite_entity\Plugin\bibcite\link;
use Drupal\bibcite_entity\Entity\ReferenceInterface;
use Drupal\bibcite_entity\Plugin\BibciteLinkPluginBase;
use Drupal\Core\Url;
class GoogleScholar extends BibciteLinkPluginBase {
public function buildUrl(ReferenceInterface $reference) {
$title_field = $reference
->get('title');
if (!$title_field
->isEmpty()) {
return Url::fromUri('https://scholar.google.com/scholar', [
'query' => [
'btnG' => 'Search+Scholar',
'as_q' => '"' . str_replace([
' ',
'(',
')',
], [
'+',
], $title_field->value) . '"',
'as_occt' => 'any',
'as_epq' => '',
'as_oq' => '',
'as_eq' => '',
'as_publication' => '',
'as_ylo' => '',
'as_yhi' => '',
'as_sdtAAP' => 1,
'as_sdtp' => 1,
],
]);
}
return NULL;
}
}