public function JanrainMarkupBuilder::getPageAttachment in Janrain Registration 8
Get needed for inclusion to HTML page Janrain scripts as attachment array.
Return value
array Attachment array.
File
- src/
JanrainMarkupBuilder.php, line 47
Class
- JanrainMarkupBuilder
- Builds needed markup for including Janrain functionality in HTML page.
Namespace
Drupal\janrain_captureCode
public function getPageAttachment() : array {
global $base_url, $base_path;
// Load entire configuration data array with overrides to allow
// per-environment configuration using settings.[ENV].php.
$settings = $this->janrainCaptureSettings
->get();
unset($settings['capture']['client_secret']);
foreach ([
'redirect_uri' => 'janrain_capture.oauth',
'federate_logout_uri' => 'janrain_capture.simple_logout',
] as $setting => $route) {
$settings['capture'][$setting] = Url::fromRoute($route)
->setAbsolute()
->toString();
}
// Federate.
$settings['capture']['federate_xd_reciever'] = $base_url . $base_path . drupal_get_path('module', 'janrain_capture') . '/xdcomm.html';
$settings['capture']['stylesheets'][] = file_create_url(drupal_get_path('module', 'janrain_capture') . '/janrain-capture-screens/stylesheets/janrain.css');
if (isset($settings['screens']['folder'])) {
$settings['capture']['stylesheets'][] = file_create_url($settings['screens']['folder'] . '/stylesheets/janrain.css');
}
// @todo Investigate docs for more info about federateSupportedSegments.
if (isset($settings['capture']['federate_supported_segments'])) {
$settings['capture']['federate_supported_segments'] = json_encode(explode(',', $settings['capture']['federate_supported_segments']));
}
return [
'library' => [
'janrain_capture/janrain_init',
],
'drupalSettings' => [
'janrain' => $settings,
'acquia_env' => $_ENV['AH_SITE_ENVIRONMENT'] ?? 'local',
],
];
}